Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Reload previous page on "back" button.

Posted on 2007-10-03
5
Medium Priority
?
3,149 Views
Last Modified: 2013-11-19
Hello JS gurus.

Do you know if there's any way, using JavaScript, to ensure that when the back button is pressed, the previous page (history.go(-1)) is *reloaded* for *all users*, rather than just loaded from the cache?

I thought it might be possible to put JavaScript into the page that would reload it if it was reached by pressing the back button, but I have no idea how to detect if this is the case.

Any help would be most appreciated.

Robin.
0
Comment
Question by:ratWonder
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 20006156
You should fix your application so it can handle a back or not depend on handling a back

You can expire the page and use POST for one
0
 
LVL 4

Author Comment

by:ratWonder
ID: 20006290
Sorry I didn't understand that.

I tried preventing the browser from caching by adding:
  <meta http-equiv="Pragma" content="no-cache" />
  <meta http-equiv="Expires" content="-1" />

But no joy - when I click back it still shows the old version of the page.
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 2000 total points
ID: 20007193
1. you cannot safely detect a back button
2. In page1 you can reload if a cookie is set from page2 (and delete the  cookie), and set a cookie on page2
3. if you have a form and you change the method to POST the page will complain if you use the back button
4. you can remove the page completely from the history by
<a href="page2.html" onClick="location.replace(this.href); return false">Go to page 2 and never return to page1</a>
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20432400
Forced accept.

Computer101
EE Admin
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

571 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