Reputation: 67
I am new to iOS and loading my website developed in jQuery Mobile to a WKWebView
in Swift 4 and Xcode 9. After loading it inside a controller, I noticed that JavaScript is not called on some pages (for example, buttons that open the dialer to call and social sharing buttons don't work).
My code for loading the page:
let myURL = URL(string: "https://www.mySiteUrl.com")
let myRequest = URLRequest(url: myURL!)
webView.load(myRequest)
Upvotes: 2
Views: 3449
Reputation: 58029
It is likely that the JS scripts are from a non-HTTPS source and you left App Transport Security's Allow Arbitrary Loads disabled.
Here is how to fix that:
Check whether there is a dictionary called App Transport Security Settings. If not, create it.
Inside it, create a boolean value called Allow Arbitrary Loads (if it's not there yet) and set it to YES.
Upvotes: 2