IOS 11.1 SecurityError (DOM Exception 18): Blocked attempt to use history.replaceState() to change session history URL

风格不统一 提交于 2019-12-22 06:47:36

问题


I am developing a mobile app using Cordova and jQuery Mobile. My app was working fine for iOS 11.0.3 and then when iOS 11.1 came out, I am getting an error and unable to click on any links. The error I get in the safari error console is "SecurityError (DOM Exception 18): Blocked attempt to use history.replaceState() to change session history URL." I have added <meta http-equiv="Content-Security-Policy" content="default-src * data: blob: ws: wss: gap://ready file://*; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * ws: wss:;"> because I thought it might be part of the Content Security Policy but I am still receiving the same error. I am using jQuery Mobile 1.4.5 and jQuery 2.1.1.


回答1:


Please update following value in angular.js file.

OLD VALUE:

this.$$absUrl = appBaseNoFile + this.$$url.substr(1); 

NEW VALUE:

this.$$absUrl = appBaseNoFile + this.$$url;

ios11 gives error because of this: file:/// != file://




回答2:


i have exactly the same issue.

Disabling html5 mode worked for me (as im not using route or state providers)



来源:https://stackoverflow.com/questions/47145052/ios-11-1-securityerror-dom-exception-18-blocked-attempt-to-use-history-replac

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