Problems with window.history using JQuery/Javascript on Cordova app in IOS9

后端 未结 2 1056
情深已故
情深已故 2021-02-04 13:12

I\'m having trouble with a Cordova app under IOS9 (beta). I\'m using latest Cordova and JQuery mobile builds. The window.history is not getting updated which is causing the fol

相关标签:
2条回答
  • 2021-02-04 13:29

    Hi you can use below code to overcome the issue.

     <a href="#" onClick="goBack();">
         Back To Previous Page
     </a>
    <script>
        function goBack() {
            event.preventDefault();
            window.location.href = document.referrer;
            return false;
        }
    </script>
    

    Hope this helps you :)

    0 讨论(0)
  • 2021-02-04 13:37

    I see this was a couple weeks ago, but I'll post this in case someone else runs into it. It sounds like it may be related to navigation events generated by a hash change in iOS 9. If so, you can add this to your index.html to disable the hash listening:

    (needs to go between the jquery.js and jquery.mobile-1.4.5.js as shown here)

    <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
    <script type="text/javascript">
      $(document).bind("mobileinit", function(){
          $.mobile.hashListeningEnabled = false;
      });
    </script>  
    <script type="text/javascript" charset="utf-8" src="js/jquery.mobile-1.4.5.js"></script>
    
    0 讨论(0)
提交回复
热议问题