Here is the scenario:
(fyi, in the following, when I say 'window.location=...' it is triggered by a button tap)
I have three pages: 1.html, 2.html, 3.html. I navigate following way:
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 last step 1.html loads but then contents of 2.html are loaded inside the DOM replacing contents of 1.html so I'm on 1.html but see contents of 2.html.
What is happening? Why does jQuery mobile think that it has to load contents of 2.html?
I'm pretty sure it has to do with history and Back button. If I just navigate between 1.html and 2.html without using Back button, it works.
update Here is code http://jsfiddle.net/x6bxN/ To reproduce you'll want to take code from HTML box and separate it into three separate files.