I've an WKWebView whose load a local html file named 'start.html'. Inside this file, i load an other local document in iframe.
But i'm not allowed to use js from start.html on iframe content and iframe content not allowed to load js file.
Before WKWebView i've use UIWebView but i'm forced to migrate to improve performance
In UIWebView i never had any problems with the crossdomain security.
When i add attribute sandbox='allow-same-origin'
on iframe, i can successfully execute js code from start.html like this
$("#frame")[0].contentWindow.document.getElementsByClassName('password_field')[0].value = password_field
but js code and http requests inside iframe (file loaded in iframe is a js player) is not allowed to run, i get theses errors :
Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.
What is the difference between UIWebVIew and WKWebView. Is there a solution to allow js code and http requests inside iframe ?
WKWebView
is only allowed to read local content stored in the directory provided by NSTemporaryDirectory()
.
Please see my answer here for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With