Skip to content Skip to sidebar Skip to footer

Can We Disable Browser's Buttons(back/forward/refresh) By Javascript

Possible Duplicate: Disable browser's back button Is there any way to disable browser(specifically IE) BACK button, FORWARD button, REFRESH button by javascript. So that, when e

Solution 1:

No, you cannot reliably, reasonably do that. Even IE's "kiosk mode" allows back, forward, and refresh (via keyboard shortcuts).

On an actual web page (a real page out on the web), disabling back/forward/refresh would of course be extremely inappropriate behavior and I assume that's not what you're trying to do. (Instead, use history libraries and such to ensure your page/web app actually works with the back and forward buttons to do what the user expects.)

Mind you, if you provide a link that opens a new window (which will probably actually end up being a new tab in most modern browsers), your page will be the first page in that window's history and so the Back button will automatically be disabled. And if your page doesn't offer any links anywhere else, it'll stay that way. And if the user hasn't gone Back, by definition they can't go Forward. Nothing you can do about Refresh, though.

If you have a genuine reason for actually disabling those actions (some kind of intranet application, that sort of thing), you'll probably have to distribute an actual application (for instance, .Net app via No Touch Deployment or similar) that incorporates a web browser control, which gives you the HTML/CSS/JavaScript environment but with dramatically higher control over that environment.

Solution 2:

As far as I know, you can't modify the buttons in a browser with scripts.

Since you're working with IE, you may be able to use either VBScript or JScript, but I doubt you'll be able to disable the reload button.

More reading:

http://www.webdeveloper.com/forum/showthread.php?t=62177

Post a Comment for "Can We Disable Browser's Buttons(back/forward/refresh) By Javascript"