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

x
?
Solved

Go Back 1 Page & Refresh

Posted on 2005-05-13
7
Medium Priority
?
644 Views
Last Modified: 2012-06-27
Hello,

Does anyone know a way to go back in the history one page & then perform a single refresh?

Thanks!
0
Comment
Question by:lexcio
  • 4
  • 3
7 Comments
 
LVL 36

Expert Comment

by:Zyloch
ID: 14000867
Hi lexcio,

Going back in the history one place is simply:

history.go(-1);

As for the refresh, you'd have to do:

window.location.reload();

in the window that you go back to. If it is to have it retrieve new material instead of cached material, you can send several headers with <meta> tag or server-side language that tells the browser to not cache the page.

Regards,
Zyloch
0
 

Author Comment

by:lexcio
ID: 14000984
>>If it is to have it retrieve new material instead of cached material, you can send several headers with <meta> tag or server-side language that tells the browser to not cache the page.

It is material from a database. How can you do this?

Thanks!
0
 
LVL 36

Accepted Solution

by:
Zyloch earned 2000 total points
ID: 14000995
Ah I see the dilemma. Instead of doing history.go(-1) you can try something that is not the most reliable but should work under most instances:

window.location.href = document.referer;

Although it's much safer doing something server-side if at all possible.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:lexcio
ID: 14001042
not working. thanks anyways!
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 14001051
That is my mistake. Missed a r. Shoul dbe

window.location.href = document.referrer;
0
 

Author Comment

by:lexcio
ID: 14001210
window.location.href = document.referrer does not work in this situation.  It would work if I could get the page to go back & refresh (as it works when I do it manually), but apparently that isn't an option.

Thanks again!
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 14001219
Sending headers that stop caching may make the browser call the database code again. Why not try that?
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

572 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