javascript - JqueryMobile (SPA) Disable Browser backbutton and Refresh? -


Hello, I'm using the jqueryMobile SPA template for my Phone-gap app.

My requirement for web frequency is to disable or show the warning message to the user on the click of a browser back button I speeded up my need but I did not find any desired solution. Please guide me Thank you.

To disable the browser's backback, I

  $ ( Window). ("Navigate", function (event) {event.preventDefault (); window.history.forward (1);});  

But pressing F5 was causing this error and redirecting me to the login page. So I disable the f5, ctrl + r button.

  var ctrlKeyDown = false; $ (Document) .on ("pagecreate", function () {$ (document) .on ("keydown", keydown); $ (document) .on ("keyup", keyup);}); Function Pred Down (E) {if ((e.wich || e.keyCode) == 116 || ((e.wich || e.keyCode) == 82 and ctrlKeyDown)) // Press F5 or Ctrl + R e.preventDefault (); } And if ((e.which || e.keyCode) == 17) {// just press Ctrl and ctrlKeyDown = true; }} Function keyp (e) {// key encoding if ((e.which || e.keyCode) == 17) ctrlKeyDown = false; }  

It has completely fulfilled my requirement. Thanks to Suhas :).


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? -