简体   繁体   中英

history.back() doesn't work in Safari on iOS

My app is based on AngularJS 1.2.3. The application is enabled as a web app for iOS. The app contains back buttons with onclick handlers with the following code

history.length && history.back()

I've also tried using history.go(-1) as well. Problem is, the browser doesn't navigate back in history in Safari on iOS, or when the app is saved to the home screen as a web app. One thing i find weird however is that it works fine in Chrome on Safari, as Chrome actually is the Safari browser engine.

I know it have worked before, but doesn't anymore for some reason. The iPad is running iOS 7.0.4.

If you are using AppCache history.back will not work on iOS7 (check http://www.sencha.com/blog/the-html5-scorecard-the-good-the-bad-and-the-ugly-in-ios7/ ).

So if that's the problem, the easiest solution is to disable AppCache.

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