aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Back Button disabling using javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Back Button disabling using javascript" Watch "Back Button disabling using javascript" New topic
Author

Back Button disabling using javascript

Ajay Vikas
Ranch Hand

Joined: Nov 08, 2006
Posts: 66
Can anybody please advice me how to disable back button of a window using java script?

Thanks in advance!!!

Regards,
Ajay.
stef li
Greenhorn

Joined: Jan 16, 2006
Posts: 27
there are two approaches to involve it.
1.
window.open(url);
window.opener.close();

2.
window.location.replace(url);


example:
<a href="#" on*click="window.location.replace('http://www.stefli.com/');">stefli</a>


This guy is so lazy!!!<br />There is nothing left!
Ajay Vikas
Ranch Hand

Joined: Nov 08, 2006
Posts: 66
Hi stef ,

Thank you for your quick reply it is working.

--
Regards,
Ajay
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Option 1 is really bad and browser security should prevent it
Option 2 will fail with users with JS disabled.

A better option for #2


Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Back Button disabling using javascript