SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: history.go(-1) in Opera
-
Feb 3, 2008, 14:56 #1
history.go(-1) in Opera
I'm using
Code HTML4Strict:<a onclick="history.go(-1);return false;" href="test.php">« Back</a>
In FF works ok but in Opera it needs 2 clicks to work properly. Does anyone knows a fix for this?
-
Feb 3, 2008, 16:55 #2
- Join Date
- Sep 2005
- Location
- Tanzania
- Posts
- 4,662
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
It might have something to do with Opera's way of going back super fast.
Ultimately you could do something like this:
HTML Code:<a href="lastpage.php" id="back">Back</a>
Code Javascript:document.getElementById('back').onclick = function(e) { if (!e) window.event.returnValue = false; else e.preventDefault(); history.go(-1); window.setTimeout(function() { history.go(-1); }, 200); }
-
Feb 3, 2008, 18:03 #3
- Join Date
- Oct 2005
- Location
- Michigan, USA
- Posts
- 434
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
That code should work. Is there a frame on the page?
-
Feb 4, 2008, 03:07 #4
Thanks Raffles, it works now.
@QMonnkey
There are no frames.
Bookmarks