Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Named anchors and querystrings.

Status
Not open for further replies.

travisbrown

Technical User
Dec 31, 2001
1,016
I'm trying to figure out an all browser method of jumping to a named anchor or id with a querystring also in the url. In IE it seems to work, in FF it doesn't jump when the page loads, but does jup properly if i put the cursor in the address bok and hit return, but doesn't work if I hit refresh.

Can't get it working at all in Safari.

Here's an example.

glossary.php?key=k-m&#a76

<h1 id="a76">...
 
What happens if you remove the trailing ampersand before the hash?

I'm sure it's not valid syntax to have an ampersand with no key/value after it (although don't quote me on this!)

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
I tried it both ways - I think it worked in IE but not Mozilla - or the other way around. Apparently, from my readings, putting the ampersand in makes it more compatible by one browser. It was odd that it wouldn't work on pageload or refresh, but would if I hit return in the address bar.

Any ideas on other methods to achieve the same result? I could put things in a POST or session var, but there's got to be a simpler way.
 
Apparently, from my readings, putting the ampersand in makes it more compatible by one browser.

Can you post that reference - it's not that I don't believe you, but (as mentioned above) I don't kbnow enough about this, and I'd certainly like to glean more information.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Huh. I thought I responded earlier, but my post isn't here.

I can't remember the ref for the ampersand thing - it was one post on a forum. I did come across this explaining the URI mehod, but nothing about compatibility.
Here's the example I'm working on: - it's a remote call for the content, so you'd have to look at generated content.

You can take the querystring out - it's redundant in this page. You'll see that it works only when clicking enter in the address box in FF, not when reloading or inital load of the page. In IE it only works when I take the QS out.

I was just using id vaues to target, but added in named anchors too because I'm reading that some versions of Safari won't target ids, only anchors.
 
Think I figured out what it was. Because the content is a client side remote call, I guess the browser couldn't find the id until the generated content was cached - why it would work when clicking enter in the address bar and not inital load or reloading the page, maybe? I thought the browser would only search for the id after the entire page loaded, including generated content.

Worked fine when I did a serverside remote call so the content was server up locally.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top