OK, I found a solution for Opera:

history.navigationMode ='compatible';

Example:

if(navigator.userAgent.indexOf('Opera')!=-1){
      history.navigationMode ='compatible';
      window.onload = windowOnload;
    }else{
      $(document).ready(windowOnload);
    }
    //----------------------------------------
    function windowOnload(){
      alert('test');
    }

This page (http://www.opera.com/support/search/view/827/) has more info on 
Opera's fix for this.
Perhaps this fix should be added to the ready function?




----- Original Message ----
From: billgadget <[EMAIL PROTECTED]>
To: jQuery (English) <jquery-en@googlegroups.com>
Sent: Friday, October 3, 2008 10:42:30 AM
Subject: [jQuery] ready function does not fire in Opera when the Back button is 
used


The ready function does not fire when you hit the Back button in Opera
(tested in Opera 9.52 Windows XP).  It does fire in FF3, IE7, and
Safari.

Example:
<html>
<head>
<meta http-equiv="expires" content="0">
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(
                               function(){
                                alert('test');
                               }
                            );
</script>
</head>
<body>
<h1>Test of the page load event and the Back button using jQuery</h1>
</body>
</html>

Create a web page that is using this example code and then load it in
Opera - you get an alert box pop-up.  Then go to another page and then
hit the Back button.  The alert box does NOT pop up in Opera.

Any ideas how to solve this?  I need a cross-browser way to run my
JavaScript every time the page loads.  I've used Firefox's pageshow in
the past, but that only works in that browser.  Thanks!

Reply via email to