Skip to content Skip to sidebar Skip to footer

Javascript Does Not Work In Ie8

The following JavaScript works on IE7 but not on IE8: onclick=history.back(1) or history.go(-1) Any suggestions on why this is the case and how to overcome it.

Solution 1:

Have you tried:

onclick="history.back()"

with the quotes?


And, responding to your statement that it doesn't work: au contraire, mon ami.

The following two files run fine on my IE8 install, using the files x1.html:

<html><head></head><body>
        X1
        <hr><ahref="x2.html">x2</a></body></html>

and x2.html:

<html><head></head><body>
        X2
        <hr><buttononclick="history.back()">Back!</button></body></html>

When I load x1, I can move to x2 with the link, then the button moves back to x1.

This works in all three compatibility modes, ergo it must be a setting on your browser which is affecting this.

One thing I had to do to get this to work was to go to Tools -> Internet Options -> Advanced -> Security and select Allow active content to run in files on My Computer, so it's almost certainly a security setting in your browser which is causing you grief.

Solution 2:

i used this and works well :

<asp:ButtonID="Back_BTN"runat="server"Text="بازگشت"onclientclick="javascript:history.back(1);return false;" />

Solution 3:

I also had this problem. Never check its also the same on ie7 or not

Code like below cant run on IE8. Can on FF3.5

<selectsize="2"><optiononclick="alert('hey hey')">Hey hey</option><optiononclick="alert('a ha')">A Ha</option></select>

However, this on work

<selectonclick="alert('uh oh')"size="2"><option>Hey hey</option><option>A Ha</option></select>

Solution 4:

I had the same problem and solved it like this...

<ahref='javascript:history.back(); 'onclick="history.back(); "><inputtype="button"value="Back" /></a>

You need to put history.back() into your a href tag and also the onclick event.

Solution 5:

Try history.back(), if that doesn't work then try this history.back();return false;

Post a Comment for "Javascript Does Not Work In Ie8"