ruliang / reallysimplehistory

Automatically exported from code.google.com/p/reallysimplehistory
Other
0 stars 0 forks source link

History stack appears to be wrong in IE7 works fine in Firefox 3 #70

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If I click through several links that call dhtmlHistory.add() I can see the
url changes as expected and the first time I click the back button the
browser takes me back to the previous hash which is what I would expect. If
again click the back button the hash changes but seems to go forward and
does not call the historyListener() function. Here is a diagram of what I
am doing:

1. I click a link to go to #page2.
2. I click a link to go to #page3.
3. I click a link to go to #page4.
4. I click the back button and I go to #page3 and the listener fires correctly.
5. I click the back button again and the url changes to #page4 and the
listener does not fire.

I am using IE7 on Windows XP. I have tested the same code in Firefox and it
works as I would expect.

Any ideas?

Original issue reported on code.google.com by stephen....@gmail.com on 5 Nov 2008 at 10:38

GoogleCodeExporter commented 9 years ago
In addition I am using SSL. Could this cause an issue?

Original comment by stephen....@gmail.com on 5 Nov 2008 at 11:28

GoogleCodeExporter commented 9 years ago
I have solved the issue. It seems to be caused by having a <div> with an id 
attribute
that has the same value as the hash in the url. Very odd and hard to debug. 
Hope this
helps others who are experiencing the same issue.

Diagram:

::::: Broken Code :::::

<a href="javascript:dhtmlHistory.add('location');">link</a>
<div id="location"></div>

::::: Fixed Code :::::

<a href="javascript:dhtmlHistory.add('tab-location');">link</a>
<div id="location"></div>

Original comment by stephen....@gmail.com on 5 Nov 2008 at 1:46

GoogleCodeExporter commented 9 years ago
Thank you so much I had the same problem, I can confirm that with the latest svn
build the history did not work correctly when I had an h3 element with the same 
ID as
the # location. (so not just divs).

I changed it to an additional class instead of an ID and it now works.

Original comment by wingp...@yahoo.com on 24 Jul 2009 at 9:19