简体   繁体   中英

Angularjs: $window.history.go not working in ios

My webapp is using angularjs-1.5.11 and we are using below line to go back in the application:

$window.history.go(-1)

This is not working in ios 10.2.1 I've tried the below, but didn't work

window.history.go(-1) 
history.back()
navigator.app.backHistory

I saw other posts which suggests to disable hashListening but I'm not sure how to do this in angularjs.

Anyone has suggestions please.

Try do it using jquery

  $(document).bind('mobileinit', function () {

      $.mobile.hashListeningEnabled = false;
      $.mobile.linkBindingEnabled = false;

  });

And also make sure that your files in this order

<script src="jquery.js"></script>
<script src="custom-scripting.js"></script> <!-- Note your script before jqm -->
<script src="jquery-mobile.js"></script>

使用下面的代码

<button type="button" onclick="goBack()">Go To Back</button> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM