General discussion

Locked

How do I block a browsers reload button

By SN_Web_Designer ·
Can someone tell me if it's possible to block the reload button in a browser by using either PHP or Javascript? If so, how would I do it? I can't seem to find anything about this anywhere else.

Thanks.

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

don't allow reload from server side

by Jay Eckles In reply to How do I block a browsers ...

You can't effectively block browser controls using either server or client side programming. The only thing I can think of that you could do is refuse to reload the page from the server side.

If you site is PHP, then each time a request is made for a page, check the HTTP_REFERER. If it is the same as the page you're processing, then don't respond as normal. Instead, send an error message, alternate content, or a skeleton page like below:
<html>
<body onLoad="window.history.go(-1);">
Please wait while you are returned to the page...
</body>
</html>
That would immediately return the user to the previous page, effectively negating the reload. Of course, the "go back" code will only work for clients with Javascript enabled.

Jay

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums