mdoland
asked on
Go to login page if trying to reach old pages
What do I need to do if I want the browser to go to the login page if I for instance try to reach old url:s from the history?
I use html and javascript on jboss.
I use html and javascript on jboss.
ASKER
Yes, hitting the back button is a good example.
unfortunately you cannot detect if a user hits the back button :(
only think i can really think of to try is a javascript function in the body of your HTML
function redirect(){
window.location = "www.google.com";
}
<!--before your </body> tag -->
<body onload="redirect()">
only think i can really think of to try is a javascript function in the body of your HTML
function redirect(){
window.location = "www.google.com";
}
<!--before your </body> tag -->
<body onload="redirect()">
You cannot prevent the user from accessing the historical pages; nor should you attempt such a hack. All you will do is make the page less acccessible and any user with an ounce of sense will avoid the page in the future as it should be regarded as a potentially dangerous page.
You are trying to override user controls and fortunately modern browsers are not going to let you do it.
In some browsers you can put up a message using a beforeunload event, but you cannot force the user to go to a home page or anywhere else.
Cd&
You are trying to override user controls and fortunately modern browsers are not going to let you do it.
In some browsers you can put up a message using a beforeunload event, but you cannot force the user to go to a home page or anywhere else.
Cd&
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I am not sure if that can be done
if it was a cookie from within your page you could do a simple javascript if statement to redirect to the url.. from a logical standpoint I cannot think of a way to do it form your browser history.
OR are you talking about hitting the back button in the broswer and going back to previous page ?