Back button problem after redirect detail
The problem happen when you want to redirect a page to another page in jquery mobile and then user have no way to get back to previous page, what we need to navigate to previous page via back button. Here is the way you usually use to redirect a page to a extenal page
window.location.href = "page2.html";
And the problem happen, you have no way to get back with back button of browser.
Solve the back button problem in jQuery mobile redirection
We have 2 ways to solve this issue
- Capture the navigation event and control the previous page manually
- Re-use the click event of jquery mobile for A tag
The option (1) will make the problem much more complex since we have to control the previous and the next page history. jQuery mobile already control them for us via external rel of tag a. Let ‘s implement a hidden a tag to handle the event like this.
<a id="hidden-redirection-tag" href="#" rel="external" style="display:none;">hidden link</a>
2 responses to “Back button problem after redirect in jQuery Mobile”
It ‘s the best way to do in jQuery mobile framework
Cool, it work nice. Thanks for your tips, it ‘s the best way to make the job work cross browser