Using multiple fragment identifiers in a URL

pixel_pusher picture pixel_pusher · Feb 11, 2011 · Viewed 8.5k times · Source

I was wondering whether I can use multiple fragment identifiers in a url, sort of like this: http://example.com/videos/index.html#videos#video_2

I'm using jQuery Tools tabbing system on my index.html page, with the history plugin. This page's "Videos" tab has a flash video player and list of videos on it. Clicking on a video thumbnail loads the file into the player.

I would like a visitor to be able to bookmark not just the #videos tab, but also a specific video.

Am I going about it totally wrong to think having two fragment identifiers in the URL would be the way to achieve this?

Answer

Sir Crispalot picture Sir Crispalot · Feb 11, 2011

I'm pretty sure that a double anchor link is impossible!

You could put a pointer to the correct tab and video in the query string of the url (e.g. mysite.com/videos/index.html?tab=video&video=2) and then parse this in JavaScript. This can then be bookmarked.

However couldn't you stick with the original model (using a single # anchor link) and then simply use JavaScript to find which tab that tag is in, and therefore show the correct tab?