Go back and Refresh

Is there a way to have a Javascript link Go Back and Refresh a page I just uploaded files to.


Currently I'm using this for Go Back. Just need to figure out out to refresh
<a href="javascript:history.go(-1)">
&lt;&lt; Go Back
</a>

Thanks
kevinbenedictAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ZvonkoConnect With a Mentor Systems architectCommented:
No. For two reasons: wrong syntax and even when the Server side is evaluated correctly, then you need no reload ;-)

I would do it like this:
<script>
if(document.referrer.indexOf("user.htm")>-1 && location.hash.indexOf("#reloaded")<0){
  window.location=window.location.href+"#reloaded";
}
</script>


0
 
darksinclairCommented:

<a href="jvaascript:history.go(-1);window.location = window.location.href">

or you could use the reload() function aswell.
0
 
ZvonkoSystems architectCommented:
After go it is gone ;-)
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
ZvonkoSystems architectCommented:
That does say, you cannot influence the previous page in no way.
0
 
darksinclairCommented:
You could do this however, On the page you are going back too (the previous one)  you could include the code such that

if Request.ServerVariables("HTTP_REFERER") = forwardPage.asp Then
  <script> window.location = window.location.href</Script>
end if

... you'd just have to get the HTTP_REFERER for whatever language you are writing in. ( example is in ASP )

Cheers ?
0
 
darksinclairCommented:
and yes Zvonko was correct about my post, I forgot that as soon as you say .go() it leaves the page.  I thought you could maybe throw it an extra argument,

Thanks Zvonko,

Cheers,
0
 
kevinbenedictAuthor Commented:
What is the reload function?
0
 
ZvonkoSystems architectCommented:
window.location.reload(true);

0
 
ZvonkoSystems architectCommented:
Do you want to produce an infinite loop? ;-)
0
 
kevinbenedictAuthor Commented:
I actuall did that once. Not fun.
0
 
ZvonkoSystems architectCommented:
Ok, now you are warned :)
0
 
kevinbenedictAuthor Commented:
So on the page I'm going back to it should be like this?

<%
if Request.ServerVariables("HTTP_REFERER") = upload_success.asp Then
  <script> window.location = window.location.href</Script>
end if
/%>
0
 
ZvonkoSystems architectCommented:
Sorry, user.htm was my test referer. You need of course your "upload_success.asp" as search string.
0
 
kevinbenedictAuthor Commented:
It's try to work but I'm getting some interference with my code for ABC Upload..

ABCUpload4.XField.4 error '80004005'

Unable to convert virtual to physical path. A Windows error - Unspecified error - (0x80004005) occurred.

/partnersite/forms/upload_success.asp, line 26


I'll have to look at it tomorrow.
0
 
cheyennejkConnect With a Mentor Commented:
Here are two clean ways:

OPTION 1:  Use Buttons

<table><tr>
<td><input type="button" value="Refresh Page" onclick="window.location.reload()"></td>
<td><input type="button" value="Go Back" onclick="javascript:history.back()"></td>
</tr></table>


OPTION 1:  Use Links
<a href="javascript:history.back()">   CLICK HERE TO GO BACK    </a>
<a href="javascript:window.location.reload()">CLICK HERE TO REFRESH </a>
0
 
ZvonkoSystems architectCommented:
Thanks for points.
0
 
kevinbenedictAuthor Commented:
thanks for the help:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.