Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Easy I think!?

Posted on 2004-04-27
15
504 Views
Last Modified: 2010-04-01
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
Comment
Question by:Pigdogmonster
  • 5
  • 4
  • 3
  • +2
15 Comments
 
LVL 32

Expert Comment

by:ldbkutty
ID: 10929662
       <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
        <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
        <meta HTTP-EQUIV="Expires" CONTENT="0">
0
 

Author Comment

by:Pigdogmonster
ID: 10929741
tried that too!

is there another way to refresh the browser after going back?
0
 
LVL 13

Accepted Solution

by:
copyPasteGhost earned 20 total points
ID: 10929762
<%
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 35

Expert Comment

by:TimYates
ID: 10929813
<%
        // 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
 
LVL 13

Expert Comment

by:copyPasteGhost
ID: 10929817
:)
0
 

Author Comment

by:Pigdogmonster
ID: 10929844
copyPasteGhost,

Thta puts me on a blank white screen,  almost there I think!! :-)
0
 
LVL 13

Expert Comment

by:copyPasteGhost
ID: 10929858
:D well you have to add the content :)
Ghost
0
 
LVL 35

Expert Comment

by:TimYates
ID: 10929864
:D
0
 

Author Comment

by:Pigdogmonster
ID: 10929951
Sorry, have used Tims and get the same thing!

help!
0
 
LVL 35

Expert Comment

by:TimYates
ID: 10929990
No errors?  It just doesn't work?

Odd...

What is your JSP code?

Have you tried with a simple test page?
0
 
LVL 13

Expert Comment

by:copyPasteGhost
ID: 10930002
<%
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
 

Author Comment

by:Pigdogmonster
ID: 10936800
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
 
LVL 4

Expert Comment

by:indigostark
ID: 10936974
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
 

Author Comment

by:Pigdogmonster
ID: 10937034
To add to the saga -

It works perfectly on my collegues laptop?!
0
 
LVL 4

Expert Comment

by:indigostark
ID: 10937111
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet init param and contect param 3 66
Market Place not working in Eclipse Luna 2 118
servlet example 17 51
jsp login check 12 42
Some of the SEO trends we might expect in 2017.
Many businesses neglect disaster recovery and treat it as an after-thought. I can tell you first hand that data will be lost, hard drives die, servers will be hacked, and careless (or malicious) employees can ruin your data.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question