WKWebView 解决跨域问题

作者: lindong | 来源:发表于2018-07-19 19:21 被阅读0次
        WKUserContentController *userContentController = [[WKUserContentController alloc] init];
        [self registerAllJavascriptWithUserContent:userContentController];
        WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
        config.userContentController = userContentController;
        config.preferences.javaScriptEnabled = YES;
        config.preferences.javaScriptCanOpenWindowsAutomatically = YES;
        config.suppressesIncrementalRendering = YES; // 是否支持记忆读取
       [config.preferences setValue:@YES forKey:@"allowFileAccessFromFileURLs"];
        if (@available(iOS 10.0, *)) {
             [config setValue:@YES forKey:@"allowUniversalAccessFromFileURLs"];
        }

    相关文章

      网友评论

        本文标题:WKWebView 解决跨域问题

        本文链接:https://www.haomeiwen.com/subject/wqzkkttx.html