samedi 28 mars 2015

check login and redirect before page load

Is it possible using javascript to stop a page from loading and redirect if a cookie is not set. lets say the page index.html requires you to be logged in, and the only way to log in is via a cookie given by the page login.html how can i stop index.html loading and then redirect the user to login.html.


Thanks in advance, i know how to do this in PHP but im having issues in javascript as it executes after the page loads and by then the user could just view-source:index.html to view the source code.


Aucun commentaire:

Enregistrer un commentaire