Solved

Can history.go also refresh the destination?

Posted on 2003-10-26
5
1,191 Views
Last Modified: 2010-05-19
I've seen related questions asked a number of times, but I haven't yet seen an answer that does what I need to do.  I display a shopping cart summary block only when the cart contains items.  So when an item is added to the cart, I want to return to the page from where the item was added and show the summary block.  I now use javascript:history.go(-1)(), but you have to hit refresh when you get back to that page.  Can this history call somehow be comibined with location.reload() to cause that history page to refresh itself?  Or is there another solution to this most common of problems?  I'm using ASP if that matters, or if there's a better way to do it.

Thanks!
0
Comment
Question by:TexSoft
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:NetGroove
ID: 9625451
Put this metas on your catalog pages:

<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="cache-ontrol" CONTENT="private">
<META HTTP-EQUIV="cache-control" CONTENT="no-cache">
<META HTTP-EQUIV="expires" CONTENT="0">

And beside the refresh metas is the better way to pass the referrer URL to shoping cart page.
With this URL you can jump back to referrer directly without history steps calculation.

0
 

Author Comment

by:TexSoft
ID: 9630728
Thanks, NetGroove.  Can you help me understand what you mean when you say " the refresh metas is the better way to pass the referrer URL.  With this URL you can jump back to referrer directly without history steps calculation."?  I'm not sure how these metas affect the url other than not caching the page.

Thanks!

0
 
LVL 10

Accepted Solution

by:
NetGroove earned 100 total points
ID: 9636278
Reading my statement in that part does not make any sense :)

Ok, that were two statements:
1.) Use the METAs to make your referring page refresh.
2.) Use referrer address passing to shopping cart page go back to referrer page. Jumping back to referrer page by using its URL is better then calculating history back steps.

Direct jumping to referrer page URL will also refresh your referrer page, even without using the refresh metas.

Does this make sense to you?

0
 

Author Comment

by:TexSoft
ID: 9636307
Thanks for the clarification!

One follow-up, if you don't mind.  I guess I'll have to capture the referrer page URL in a session var.  If I use that method, what's your take on using the META's to not cache?  It sounds like I wouldn't need them, and that might save a little bandwidth.

Thanks again for your help -- I really appreciate it.
0
 
LVL 10

Expert Comment

by:NetGroove
ID: 9636384
Thanks for the points.

No, it does save band wide. It increases the traffic.
With caching set to on, that is depending on browser setting defaults, your browser checks the page headers to see whether they were changed since last fetch and they has to fetch the complete page again and use extra band wide.
The upper metas do say: do not make the header check for saving band wide and transfer always the full pages.
With that metas you ensure to have always the pages up to date, but you transfer the pages always and every time.

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

786 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