Link to home
Start Free TrialLog in
Avatar of stankstank
stankstank

asked on

Using javascript:history.go(-1) more effectively

After adding a record we use <a href="javascript:history.go(-1)">Return to whatever</a> to give the user a way to get back to the page they were viewing before adding a record.  An example of this would be adding an item to an existing order - they need to get back to the original order they added an item to.

the problem with history.go is that it doesn't actually set the hyperlink, it simply returns them to a cached page in their browser's history.  How can I make this so that it replaces the link with an actual URL?  I want the page to actually refresh when they go to it so the new record shows up...I don't want to do any javascript refreshes on the parent page or any sorry fixes like that..

Thanks alot,

Stankstank
Avatar of Chirag1211
Chirag1211
Flag of United States of America image

For this you need to set the href value to the url / page which you need to redirect to

Try the following code

<a href="Default2.aspx">Test</a>

Regards,

Chirag Patel
ASKER CERTIFIED SOLUTION
Avatar of JohnModig
JohnModig

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if you dont want to cache you can specify

Response.Cache.SetCacheability (HttpCacheability.NoCache);

Regards
Renju