Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-02-11 16:51:42

monkeynotes
Member
From: UK
Registered: 2005-04-13
Posts: 41

Anchor links and Safari

This is not specifically a TXP problem but I thought I would ask for help here anyways. I am having problems getting anchor links to work correctly in Safari from an external link or page refresh. FF and all other browsers I have tested have been fine, but Safari does not seem to want to play ball.

Try this link out in Safari and you will see it does not jump to the correct comment:
http://lastexit.thecivilpartnership.com/article/at-the-arcades#c000003

Strangely this link does work:
http://mac.7motion.com/software.php#webdev

And so indeed does this link:
http://forum.textpattern.com/viewtopic.php?pid=140098#p140098

I can’t really figure out what the significant difference is. I have tried named anchors, ids on divs, ids on anchors etc. etc. All I can think is that there is something in the way that the page is set up in CSS etc. that is causing the problem. If you actually click one of the comment permalinks then Safari does indeed jump to the anchor, this just confuses me more. I kind of need this to work on page refreshes so that adding a comment it will jump to the preview etc.

Even the TXP dev blog suffers from this curious problem:
http://textpattern.com/weblog/256/great-new-plugins#c000412

Anyone have any ideas?

Last edited by monkeynotes (2007-02-11 16:52:19)

Offline

#2 2007-02-14 19:11:14

monkeynotes
Member
From: UK
Registered: 2005-04-13
Posts: 41

Re: Anchor links and Safari

Bump for frustration…

Note: It does not seem to a style sheet problem as I removed all of the CSS and the problem still exists.

Last edited by monkeynotes (2007-02-14 19:14:22)

Offline

#3 2007-02-14 19:45:28

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,012
Website GitHub Mastodon Twitter

Re: Anchor links and Safari

it is a safari problem I can replicated it here both with the punbb forum(s) and txp

Last edited by colak (2007-02-14 19:45:48)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2007-02-14 19:48:30

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

Re: Anchor links and Safari

very simple fix … safari seem to have an issue jumping to an id … name is much more consistent and id may not also work correctly on ie/pc …

change this:
<a id=“c000003”></a>

to this (id optional):
<a name=“c000003”></a>


nuff-respec ::: dannyb

Offline

#5 2007-02-14 20:24:00

monkeynotes
Member
From: UK
Registered: 2005-04-13
Posts: 41

Re: Anchor links and Safari

dbulli wrote:

very simple fix … safari seem to have an issue jumping to an id … name is much more consistent and id may not also work correctly on ie/pc …

Thanks but unfortunately I have already tried that and it has not fixed the problem. In contradiction to what I wrote previously I have tried some experiments and removed all of the CSS and when I do this I seem to be able to jump to the anchors correctly.

I need to double check things but I think I might be getting closer to the nub of the problem. This is a total unexpected and fairly badly documented hiccup, Google reveals few answers, something about hidden overflow divs but that does not seem to relate to my problem.

Offline

#6 2007-02-14 20:48:07

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

Re: Anchor links and Safari

BTW in my Safari (1.3.2) it works fine … name is truly better, and doesn’t hurt to have both …

i have to ask … there is not enough whitespace so it does jump but it won’t go to the “correct” place but only scroll as far as it can…


nuff-respec ::: dannyb

Offline

#7 2007-02-14 21:06:04

monkeynotes
Member
From: UK
Registered: 2005-04-13
Posts: 41

Re: Anchor links and Safari

This is strange. If I save my page HTML output to my desktop and then do the same for the CSS, edit the HTML so that the CSS is now referenced to the desktop and not through my local MAMP setup, guess what; everything works perfectly. It seems the delay in loading the CSS through a webserver is enough for Safari to give up looking for the anchor link, this applies to named <a> or ID <a>. Go figure. I have no idea how to fix this.

For the record my Safari version is 2.0.4 – it seems they broke it since your version.

Offline

#8 2007-02-14 21:12:32

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

Re: Anchor links and Safari

Sorry of no help … good luck … it could also be due to network latency … i’ll look on Safari 2.0.x later …

fwiw: your image is quite big and need not be … you should be able to cut that sucker down to like 100K with minimum lost.

out of curiosity … i only have id on my site … does it work for you?
nuff-respec > anchor


nuff-respec ::: dannyb

Offline

#9 2007-02-14 21:17:26

monkeynotes
Member
From: UK
Registered: 2005-04-13
Posts: 41

Re: Anchor links and Safari

dbulli wrote:

out of curiosity … i only have id on my site … does it work for you?
nuff-respec > anchor

Sadly, no it has the same problem.

The images on the demo site are not optimised at all, they are just whacked up there without much care, the real content will be much less of a strain on a 56k :)

I just put the CSS inline in the page instead of linking, and now the anchors work even through the webserver. This is really strange. It is like Safari is waiting to close all threads before it will follow an anchor and then it forgets to follow the anchor after the CSS has loaded. I just can’t figure out this odd behaviour.

Offline

#10 2007-02-14 21:47:08

monkeynotes
Member
From: UK
Registered: 2005-04-13
Posts: 41

Re: Anchor links and Safari

OK, I think I have nailed the problem now. If I put the CSS in a file in the root of the site e.g.

<link rel="stylesheet" type="text/css" href="/default.css" />

Then everything works just gravy. For some reason Safari plays strangely with CSS that is linked in any other directory other than the root. Sadly I cannot now update the CSS as easily but at least it is linked and the anchors work. I would love to hear from anyone who can explain this unusual behaviour.

Offline

#11 2007-02-14 21:54:03

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

Re: Anchor links and Safari

So on QuirksMode it seems to be a known bug.. This maybe a hack, but you could use javascript and jump to an anchor…

.
window.onload = jumptoanchor
//.
function jumptoanchor()
{	
	//if anchor exist in url
	if(window.location.href.match(/#(\w.+)/))
	{
		//jump to anchor
		window.location.hash=window.location.href.match(/#(\w.+)/)[1]; 
	}
}

nuff-respec ::: dannyb

Offline

#12 2007-02-14 21:55:42

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

Re: Anchor links and Safari

monkeynotes wrote:

OK, I think I have nailed the problem now. If I put the CSS in a file in the root of the site e.g.

That is truly weird … i am not worrying about this … seems to be broken …


nuff-respec ::: dannyb

Offline

Board footer

Powered by FluxBB