WKWebView 解决跨域问题
WKUserContentController*userContentController = [[WKUserContentControlleralloc] init]; [selfregisterAllJavascriptWithUserContent:userContentController];WKWebViewConfiguration*config = [[WKWebViewConfigurationalloc] init]; config.userContentController = userContentController; config.preferences.javaScriptEnabled =YES; config.preferences.javaScriptCanOpenWindowsAutomatically =YES; config.suppressesIncrementalRendering =YES;// 是否支持记忆读取[config.preferences setValue:@YES forKey:@"allowFileAccessFromFileURLs"];if(@available(iOS10.0, *)) { [config setValue:@YES forKey:@"allowUniversalAccessFromFileURLs"]; }
网友评论