How to close HTML child page on button click in Phonegap
-
21-12-2019 - |
Question
I have 2 pages login.html and register.html by clicking login.html button it will go to register.html and there I have register button by clicking this I wanna go to login.html and close the register.html page in my phone(its working but after this was done when I click button from login.html) again its getting enter into register.html.
I want to close or finish the register.html page. I stuck here, Please someone help...
Login.html :
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady(){
}
function signUp(){
window.location="register.html";
}
<button onclick="signUp();">Sign Up</button>
Register.html :
function register(){
window.location="login.html";
window.close();
}
<button onclick="signUp();">Sign Up</button>
where I making stupid...
Solution
Remove this
window.close();
Then try. If doesn't work
use this
document.location
instead of
window.location
Update based on comment:
in register.html, inside deviceready
document.addEventListener("backbutton", onBackKeyDown, false);
And then
function onBackKeyDown_home()
{
document.location="login.html";
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow