Solved

Can history.go also refresh the destination?

Posted on 2003-10-26
5
1,184 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now