问题
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