javascript - PhoneGap Back Button exit the Application -


I am currently working on mobile app using PhoneGap (Cordoba 2.2), JQuery and Javascript. Landing page is a login page so when I enter the dashboard page using login credentials, when I click on the back button , its return does not remain on the dashboard page on the launch page. What can i do ??? Suggestions are welcome.

I have tried,

SCRIPT

  & lt; Head & gt; & Lt; Script type = "text / javascript" charset = "utf-8" src = "cordova-2.2.0.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" charset = "UTF-8" & gt; When the Cordoba loads, // create the device on the call // // At this point, the document has been loaded but not Cordova-2.2.0.js. // When the Cordoba is loading and talking with the native device, // this event will call `deviceready` // function onload () {document.addEventListener (" DeviceRedi ", OnDevice Read, False); } // Cordova is loaded and it is now safe to work on Cordova methods / calls. Divise Readie () {// Register the Event Listener Document. AddEventListener ("Backbutton", On Backdown, False); } // Back Button / Handle Function on Backdaddy () {Warning ("Back Button Click"); // warnings called .. test} & lt; / Script & gt;  

HTML

  & lt; Body onload = "onLoad ()" & gt; & Lt; / Body & gt;  

My on-device read and on backdown function is not working / has been removed. Am i missing something ???

Try with log in variables if call on login and do anything back function.

  Back to the function {evt.preventDefault (); Evt.stopPropagation (); If (log-in == 'yes') {// do nothing or show popup} and {history.back (); }}  

You first need to bind Event Listener, and load App Interlise () on the page or call $ (document). Ready () method.

  var app = {// Application Constructor initialize: function () {this.bindEvents (); }, // Share any event required on startup Common events are: // 'Load', 'DeviceRedi', 'Offline', and 'Online' Bind Aventus: Function () {document.addEventListener ('DeviceRedi', this. OnDeviceReady, false); }, OnDeviceReady: function () {document.addEventListener ("backbutton", on backdown, false); }};  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -