Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 925
  • Last Modified:

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?
0
mm_glebe
Asked:
mm_glebe
  • 3
  • 2
  • 2
  • +2
1 Solution
 
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
 
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
knightEknightCommented:
the "return false;" in the onClick is the key ...
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now