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

删除回忆录丶 提交于 2019-12-03 01:05:29

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>

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!