Solved

Go back and Refresh

Posted on 2004-08-25
17
2,577 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:kevinbenedict
  • 8
  • 5
  • 3
  • +1
17 Comments
 
LVL 5

Expert Comment

by:darksinclair
ID: 11897399

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

or you could use the reload() function aswell.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 11897429
After go it is gone ;-)
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 11897432
That does say, you cannot influence the previous page in no way.
0
 
LVL 5

Expert Comment

by:darksinclair
ID: 11897461
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
 
LVL 5

Expert Comment

by:darksinclair
ID: 11897494
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
 

Author Comment

by:kevinbenedict
ID: 11897947
What is the reload function?
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 11897954
window.location.reload(true);

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 11897958
Do you want to produce an infinite loop? ;-)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:kevinbenedict
ID: 11897970
I actuall did that once. Not fun.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 11897986
Ok, now you are warned :)
0
 

Author Comment

by:kevinbenedict
ID: 11898013
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
 
LVL 63

Accepted Solution

by:
Zvonko earned 125 total points
ID: 11898091
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
 
LVL 63

Expert Comment

by:Zvonko
ID: 11898101
Sorry, user.htm was my test referer. You need of course your "upload_success.asp" as search string.
0
 

Author Comment

by:kevinbenedict
ID: 11898160
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
 
LVL 2

Assisted Solution

by:cheyennejk
cheyennejk earned 125 total points
ID: 11898486
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
 
LVL 63

Expert Comment

by:Zvonko
ID: 11908167
Thanks for points.
0
 

Author Comment

by:kevinbenedict
ID: 11908173
thanks for the help:-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Check if Object property exists? 3 19
Message not shown 5 34
how would you interpret lines 3 31
how can apply the following conditionals: 5 23
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…
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…

863 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

27 Experts available now in Live!

Get 1:1 Help Now