Solved

Can history.go also refresh the destination?

Posted on 2003-10-26
5
1,201 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
[X]
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
  • 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
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

623 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