Solved

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

Posted on 2002-06-27
10
900 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…

762 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

21 Experts available now in Live!

Get 1:1 Help Now