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

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?
mm_glebeAsked:
Who is Participating?
 
knightEknightConnect With a Mentor Commented:
the "return false;" in the onClick is the key ...
0
 
lexxwernCommented:
try this

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


and make sure js is enabled in your IE5
0
 
webwomanCommented:
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
mm_glebeAuthor Commented:
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
 
webwomanCommented:
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
 
knightEknightCommented:
<a href="#" OnClick="history.go(-1);return false;">
0
 
andreifCommented:
Try

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

or

<a href="#" OnClick="history.back()">
0
 
mm_glebeAuthor Commented:
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
 
lexxwernCommented:
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
 
knightEknightCommented:
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
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.