Solved

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

Posted on 2002-06-27
10
921 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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
 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
Suggested Courses

617 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