Header Ads

how to make login session in javascript

Function checkLogin ()
{
(localStorage.login == "true") if
{
window.location.href = "is the index.html";
}
And (localStorage.login == "false") if
{
window.location.href = "login.html";
}
}
Where "true" and "false" is assigned dynamically from server = localStorage.login

Add this code to redirect the page are looply !!

Let me address:

How to execute the user-defined function destroy / remove?

Or

ondeviceready only once in jQuery to execute user-defined function, how to


Function checkLogin ()
{
Var url = window.location.pathname;
Var filename = url.substring (url.lastIndexOf ('/') + 1)

(localStorage.login == "true") if
{
window.location.href = "is the index.html";
}
And (localStorage.login == "false" && filename! = 'Login.html')
{
window.location.href = "login.html";
}
}

No comments:

Powered by Blogger.