Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2007-02-15 14:55:31

dbulli
Member
Registered: 2004-11-22
Posts: 195
Website

Re: Anchor links and Safari

Doesn’t that mean it’s a broken implementation?


nuff-respec ::: dannyb

Offline

#17 2007-02-16 03:27:58

Walker
Plugin Author
From: Boston, MA
Registered: 2004-02-24
Posts: 592
Website

Re: Anchor links and Safari

I guess so…although I am loathe to admit it without offering a serious bug report &/or patch for said bug.

Offline

#18 2007-03-14 00:08:09

robindeandotcom
New Member
Registered: 2007-03-13
Posts: 1

Re: Anchor links and Safari

I’ve done my fair share of research and testing on this issue.

Many people (we’ll call them group A) say “Safari is broken” while others (we’ll call them group B) make the argument that “no it’s not, it’s just unforgiving and people are using bad code.”

To Group A: I’ve reviewed a few of the errors that group A has produced and, they do exist in some cases.

To Group B: I’ve reviewed the Safari versions which are in question and discovered that some versions work and others don’t. The newest is problematic.

::: My Point Is :::

Everyone is absolutely correct. What’s better is that I’ve come upon the cause and a solution.

Now, none of us want to admit that Safari, who dances gracefully with the Netscape language and mixes a fine martini from the concepts of Explorer, could ever fail us.

Quite frankly, it hasn’t. Safari kicks butt in a variety of ways, so when something like this pops up … we all scream louder about a bug than usual.

Please note that the current “get anchor” javascript that is currently out there doesn’t quite work as far as I can tell. I respectfully thank the person for trying but I myself couldn’t make it happen.

Here is my own javascript solution …

function GetHash()
{
if ((navigator.userAgent.toLowerCase().indexOf(“safari”) != -1) && (window.location.href.match(/#(\w.+)/))) window.location.replace(window.location.hash);
}

::: and :::

if you don’t want sniff out Safari (IE will make two ‘click’ sounds), simply:

function GetHash()
{
if (window.location.href.match(/#(\w.+)/)) window.location.replace(window.location.hash);
}

All that remains is to call the function however you wish. I use this in an external javascript which uses window.onload = GetHash(); in it’s own right.

I hope this helps and if I’m way off base, my apologies.

The cause of the problem is related to EXTERNAL .CSS DOCUMENTS.

For whatever reason, when Safari is prompted to load the external css, it “pauses” the process of displaying the page until the css document has finished classifying how things are supposed to look.

Safari does not, however, cease it’s attempt to load the anchor target on the page.

So, while css is holding the page layout in it’s grasp, Safari aims to find something which doesn’t yet exist. Hence, nothing happens (but the page sure ends up looking pretty).

Using window.onload, this script will get everything after the ‘#’ sign and refresh the page to that anchor tag after the tag DOES exist.

Offline

#19 2007-09-21 13:53:58

bArMY
New Member
Registered: 2007-09-21
Posts: 1

Re: Anchor links and Safari

I too had this problem. I’m no expert but here is my story.

I built a a site for my company, anchor links worked fine in Safari 2.0.4 and they were linking to a div with overflow set to auto. I’m aware others seemed to have a problem with this but mine worked fine.

Later on I decided to redesing the site using templates, making it easier to update. After I had built the templates and used them my anchor links stopped working.

I think it may be a problem linking to my stylesheet, but i’m sure using a template caused the problem.

Any ideas / feedback welcomed

Offline

Board footer

Powered by FluxBB