Here is the scenario:
(fyi, in the next, when I say "window.location = ...", it starts by clicking a button)
I have three pages: 1.html, 2.html, 3.html. I navigate as follows:
1.html --- window.location="2.html" ---> 2.html
2.html --- <a href="3.html" /> ---> 3.html
click Back button
2.html --- window.location="1.html" → 1.html
In the last step, 1.html loads , but then the contents of 2.html is loaded inside the DOM, replacing the contents of 1.html, so I'm on 1.html, but I see the contents of 2.html.
What's happening? Why does jQuery mobile think it should load 2.html content?
I am sure this is due to the story and the back button. If I just navigate between 1.html and 2.html without using the back button, this works.
update Here is the code http://jsfiddle.net/x6bxN/ To reproduce, you will want to take the code from the HTML window and split it consists of three separate files.
source share