Page 1 of 1

Disable Back Button for a Page

Posted: Wed May 22, 2013 4:21 pm
by Anton Söffing

I have a Problem with my Splashscreen....
It navigates avert 4.2 seconds to the Home Page. But wehn I press back it will be go back to the Splashscreen and loads endless. How can i disable the Back Button (Hardware) only for the Home site?


Disable Back Button for a Page

Posted: Wed May 22, 2013 5:47 pm
by Kateryna Grynko

Hi Anton,

You cannot disable Back button on device, but it's possible to add any action on "Backbutton" event.


Disable Back Button for a Page

Posted: Wed May 22, 2013 11:54 pm
by Emmz

Anton.
I drop my splash screen then app cant go back.
Example
code
setTimeout(function() {Tiggzi('Splash').detach();Tiggzi.navigateTo('Menu',{ transition: "none"});},4000);
/code
Assuming you splash screen is named "splash" and the screen togoto is "Menu"
Change to suit.

AND/OR

Add this code on Device Ready
code
document.addEventListener("backbutton", mybackHandler, false);

/code
Now in custom JS add this
code
function mybackHandler() {
if ($.mobile.activePage.attr('dsid') == 'Menu'){
alert('Dont Use The BACK Button ! Click Exit Button To Exit...');
}else{
//navigator.app.backHistory();
history.back();
return;
}
}
/code