'WkWebview local site Access Origin
i have the following application as, the folder structure is as the picture above.
Then i load this index.html in the following way:
class ViewController: UIViewController, WKUIDelegate, WKNavigationDelegate{
var webView: WKWebView!
override func loadView() {
webView = WKWebView()
view = webView
}
override func viewDidLoad() {
super.viewDidLoad()
webView.uiDelegate = self
webView.navigationDelegate = self
webView.configuration.defaultWebpagePreferences.allowsContentJavaScript = true
let url = Bundle.main.url(forResource: "index", withExtension: "html", subdirectory: "iosbuild")!
webView.loadFileURL(url, allowingReadAccessTo: url)
}
}
When inspecting this in my Safari browser I get an access-origin error:
Origin null is not allowed by Access-Control-Allow-Origin.
What have I done wrong? or how I might change the URL to allow the load of my assets / scripts?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

