I have a WKWebView that loads a local html file called "start.html". Inside this file, I load another local document in an iframe.
But I am not allowed to use js from start.html for iframe content, and iframe content is not allowed to load js file.
Before WKWebView, I use UIWebView, but I have to migrate to improve performance
In UIWebView, I never had crossdomain security issues.
When I add the sandbox='allow-same-origin'
attribute to the iframe, I can successfully execute js code from start.html, like this
$("#frame")[0].contentWindow.document.getElementsByClassName('password_field')[0].value = password_field
but the js code and HTTP requests inside the iframe (the file loaded in the iframe is a js player) is not allowed to run, I get the abstract of 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 an iframe?
source share