javascript - return to index.html from images.html by using phone back button in phonegap android -
i working on android phonegap, app has 2 .html pages ,(1) index.html has multiple pages using jquery mobile, have link in index.html (2)images.html, images.html simple html page, want phone's button navigate index.html's multiple page having id #page2 when on images.html. 1 can plz me in getting work (hardware) phone's button navigate index.html#page2, have button code working absolutely fine in index.html, how can make useable index.html#page2 images.html here button code whick working index.html..... // javascript document
$("#page2").click(function(){ $.mobile.changepage("#page2"); }); document.addeventlistener("deviceready", ondeviceready, false); // phonegap loaded function ondeviceready() { console.log("phonegap ready!"); // waiting button document.addeventlistener("backbutton", handlebackbutton, false); } // handle button function handlebackbutton() { console.log("back button pressed!"); if($.mobile.activepage.is('#page2')){ //e.preventdefault(); navigator.app.exitapp(); } else { navigator.app.backhistory(); } }
try putting $.mobile.phonegapnavigationenabled = true
in mobileinit
handler per http://jquerymobile.com/demos/1.2.0/docs/pages/phonegap.html instructions.
Comments
Post a Comment