views:

28

answers:

1

As part of developing some ajax history behavior I encountered a weird thing: (my) ie7 doesn't recognize a page with different anchors (hashtags) as 2 different pages. The consequence is that when using the back-button ie7 skips over all previous urls (which only differ by the hashtag).

for example lets say I have browsed the following items in this order:

  • www.google.com
  • www.mysite.com/index#ajax1
  • www.mysite.com/index#ajax2
  • www.mysite.com/index#ajax3

hitting the backbutton while on www.mysite.com/index#ajax3 brings me back to www.google.com

I'm really breaking my head on this one. To check my sanity I tested some random pages with anchors, loaded the up and indeed the same problem.

As far as I know this is not expected behavior (all other browsers (chrome, ff, safari) tested work ok. Am I missing something really obvious here or is my install of ie7 just messed up?

A: 

This works on a local file in IE7. I haven't tested it online yet.

<a href="#hashlink1" onclick="window.location='#hashlink1';return 0;">Link to Anchor 1</a>
<a href="#hashlink2" onclick="window.location='#hashlink2';return 0;">Link to Anchor 2</a>
<a href="#hashlink3" onclick="window.location='#hashlink3';return 0;">Link to Anchor 3</a>
jnpcl
sadly, this still doesn't work for me. I'm going for a jquery history component (which seems to use a hidden iframe to handle the ie case). Accepted for your remark: '#hashtags are not entered into IE7's history'
Geert-Jan