[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 538
  • Last Modified:

Easy I think!?

Hi,

I am using the javascript method "window.history.go(-2);" in my jsp page after doing an update.  All I wnat is for my page to reload when it goes back.

I have tried putting this between the headers to stop the page from caching:-

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1" />

but this does not work -

Please help!
0
Pigdogmonster
Asked:
Pigdogmonster
  • 5
  • 4
  • 3
  • +2
1 Solution
 
ldbkuttyCommented:
       <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
        <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
        <meta HTTP-EQUIV="Expires" CONTENT="0">
0
 
PigdogmonsterAuthor Commented:
tried that too!

is there another way to refresh the browser after going back?
0
 
copyPasteGhostCommented:
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", -1);
%>

<html>
<body>
</body>
<head>
<meta http-equiv="pragma" content="no-cache" />
</head>
</html>
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
TimYatesCommented:
<%
        // Set to expire far in the past.
        response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");

        // Set standard HTTP/1.1 no-cache headers.
        response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");

        // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
        response.addHeader("Cache-Control", "post-check=0, pre-check=0");

        // Set standard HTTP/1.0 no-cache header.
        response.setHeader("Pragma", "no-cache");
%>
0
 
copyPasteGhostCommented:
:)
0
 
PigdogmonsterAuthor Commented:
copyPasteGhost,

Thta puts me on a blank white screen,  almost there I think!! :-)
0
 
copyPasteGhostCommented:
:D well you have to add the content :)
Ghost
0
 
TimYatesCommented:
:D
0
 
PigdogmonsterAuthor Commented:
Sorry, have used Tims and get the same thing!

help!
0
 
TimYatesCommented:
No errors?  It just doesn't work?

Odd...

What is your JSP code?

Have you tried with a simple test page?
0
 
copyPasteGhostCommented:
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", -1);
%>

<html>
<body>

PLACE THE CODE FOR YOUR PAGE HERE

</body>
<head>
<meta http-equiv="pragma" content="no-cache" />
</head>
</html>

try this
Cheers,
Ghost
0
 
PigdogmonsterAuthor Commented:
This is quite strange..

If I right click on my page and choose 'refresh' the page just shows as a blank white page. The same happens when I use your code or not.

I'm using Frames,  could this be anything to do with it?
0
 
indigostarkCommented:
Do the following

In your html have
==================
<html>
<head>
<title>Something</title>
   <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
   <META HTTP-EQUIV="Expires" CONTENT="-1">
.
.
.
.
.
</body>
       <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
       <META HTTP-EQUIV="Expires" CONTENT="-1">
</html>
=======================

Also in your servlet/JSP
set the response headers to be
====================
response.setHeader("Expires", "0");
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "No-cache");
0
 
PigdogmonsterAuthor Commented:
To add to the saga -

It works perfectly on my collegues laptop?!
0
 
indigostarkCommented:
For Internet Explorer
click tools -> internet options ->Settings ->

"Check for newer versions of stored pages"
click on "every visit to the page"
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 4
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now