Redirect to local html page from javascript in phonegap

I am working on a telephone. I am trying to log in and by clicking the submit button in Login.html, I have to be redirected to a local html file.

login.html

<tr> <td>&nbsp;</td> <td> <input type="submit" class="submitbtn" name="submit" id="submit" value="Login" onclick="loginCheck()"> </td> </tr> 

loginValidation.js

 if (validCustomer == true) { alert("valid customer........"); document.location.href("file:///android_asset/www/Category.html"); 

But document.location.href or window.location / window.open does not work. Can anyone help on this? If I use window.open and run the application in the emulator, it works fine, but not on the device.

+6
source share
4 answers

you can try this

 window.open("mainpage.html",'_self'); 

this will open the page in the current window, so that the current page data of the window will be cleared, and new page data will be displayed on the same page of the window.

+5
source

try using a relative path, this should work:

 window.location="Category.html"; 
0
source

Try

 window.location.replace = "Category.html"; 
-1
source
 window.location.href = 'Category.html'; 
-1
source

Source: https://habr.com/ru/post/898565/


All Articles