Solved

window.history.go(-1) not working in IE 5

Posted on 2002-06-27
10
905 Views
Last Modified: 2008-02-26
I have a html page which contains the following -

<a href="#" OnClick="window.history.go(-1)">

this works in IE 5.5, but is doing nothing in IE 5.

On a similar note, I have the following JS function

function submitForm(submittype)
{
if (validateForm())
{
with (document.form)
{
switch (submittype)
{                                     case "submit":
action = "url"
break;                                                            
}
                   
submit()

}
}
else
{
return false;
}
}

The Validate form function work reports errors, but if none the form is not submitted in IE 5, but is in IE 5.5.

Any ideas?
0
Comment
Question by:mm_glebe
  • 3
  • 2
  • 2
  • +2
10 Comments
 
LVL 12

Expert Comment

by:lexxwern
ID: 7113338
try this

<a href="#" OnClick="javascript:window.history.go(-1)">


and make sure js is enabled in your IE5
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7113404
And make sure there IS a history -- if it's a new window there isn't anything to go back to. If it's the first page they open there isn't anything to go back to.
0
 

Author Comment

by:mm_glebe
ID: 7113420
Both these cases are valid and still the same problem.

It's hard to know exactly the error as this problem is occuring on a crippled version of IE which is on a standard users machine which goes through a Proxy.
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7113502
Well, that's the problem. If you're running a non-standard browser and through a proxy to boot, you'll have lots of things that don't work.
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 7113515
<a href="#" OnClick="history.go(-1);return false;">
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.

 
LVL 6

Expert Comment

by:andreif
ID: 7113520
Try

<a href="#" OnClick="history.go(-1)">

or

<a href="#" OnClick="history.back()">
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 100 total points
ID: 7113531
the "return false;" in the onClick is the key ...
0
 

Author Comment

by:mm_glebe
ID: 7113682
Without the return false this didn't work on IE 5, but did on 5.5. Now i've got to change a lot of HTML!!

Cheers, any reason why tis is the case?
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7113701
IE5 doesn't want it to be told that its being made to go back??? funny  . . .

wierd but its good that you got a solution.
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 7113702
If you put return false in the onClick it negate the effect of the href.  So without it, the browser was trying to jump to "#" (which is the top of the page) and THEN it was doing a history.go(-1) -- going back to the previous link -- which was the "#"!

By using return false you can put whatever you want in the href and it will have no effect:

<A  href="This won't do anything!"  onClick="return false;">
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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…

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

22 Experts available now in Live!

Get 1:1 Help Now