I am changing the page with this method
$.mobile.changePage("Preview.html", {
transition : "slide",
role : "page",
changeHash:true
});
this is how my preview page looks like
<div data-role="page" data-name="preview" class="prew">
<div data-role="content">
//content
</div>
</div>
now when i touch the screen i have to go back to previous page.
so i created this function
$('.prew').live('tap', function() {
alert('clicked');
history.go(-1);//<--this works in simulator not in device.
//window.history.back() ;//<--this also works in simulator not on device.
//navigator.app.backHistory();<--this works fine on android not on iOS.
});
edit: i have used a plugin called photoswipe which causes the issue . the history.go(-1),history.back() or data-rel="back" works fine on other pages.
photoswipe is preventing from getting back to previous page.