0

I'm currently building an app which requires to login first. Login page is called using

function onDeviceReady() {
navigator.splashscreen.hide();
window.open("http:website_login_link", "_blank");
}

since that website's login page needs to be opened first when the app is launched (because only certain people are allowed to login). After login, the user is brought to the website, but I want the user be able to see other features of the app. Thus, I want to redirect to a specific page after the user is logged in. I want to set isLoggenIn = true after the user has been logged in. And then call

if (isLoggedIn == true){
    window.location("home.component.html"); // welcome page
}

But I don't know how to detect when I should set isLoggenIn = true, since I'm not storing credentials manually. So, how and when can I set isLoggenIn = true ?

kenkulan
  • 147
  • 4
  • 14
  • Possible duplicate of [How do I redirect with Javascript?](http://stackoverflow.com/questions/4744751/how-do-i-redirect-with-javascript) – Siamak Ferdos Jul 21 '16 at 06:05

2 Answers2

0

window.location = "http:website_login_link";

Siamak Ferdos
  • 3,181
  • 5
  • 29
  • 56
0

Two method

1.  window.location = "Your website"
2.  location.href="Your website"
Sumit patel
  • 3,807
  • 9
  • 34
  • 61
  • what I want to do now is: function redirect(){ if (isLoggedIn == true){ window.navigate("home.component.html"); } } However, I'm not storing the credentials in my code but just calling the login page of the website. How do I detect when isLoggedIn == true ? – kenkulan Jul 21 '16 at 09:35