How can i restrict the user from Clicking of Back button in anybrowser

Showing Answers 1 - 5 of 5 Answers

Shailesh

  • Nov 5th, 2005
 

Hi,

     Whenever our page is cached, back button displayes

cached page rather a fresh page. So if we can block the caching

anyhow, the back button will automatically get disabled. We can

achieve this working by setting two attributes in META tag.

that is

("Cache-Control", "no-cache") and

("Pragma", "No-cache")

  Was this answer useful?  Yes

Pankaj

  • Nov 7th, 2005
 

What is meta tag?

and where should i write the mentioned code.

Pankaj

  Was this answer useful?  Yes

Yogi

  • Nov 14th, 2005
 

Hi

We can write the following code in javascript to disable back button

window.history.forward(1);

  Was this answer useful?  Yes

javamatrix

  • Nov 17th, 2005
 

You will need to set the appropriate HTTP header attributes to prevent the dynamic content output by the JSP page from being cached by the browser.

Just execute the following scriptlet at the beginning of your JSP pages to prevent them from being cached at the browser. You need both the statements to take care of some of the older browser versions.

<%response.setHeader("Cache-Control","no-cache"); //HTTP 1.1response.setHeader("Pragma","no-cache"); //HTTP 1.0response.setDateHeader ("Expires", 0); //prevents caching at the proxy server%>

  Was this answer useful?  Yes

Rizwan

  • May 18th, 2006
 

Hi

just write the code as history.forward() in javascript head tag

thats all

eg

<script>

<head>history.forward()</head>

</script>

thts all

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions