您好,欢迎来到暴趣科技网。
搜索
您的当前位置:首页webview ajax没反应,WKWebView无法触发ajax在本地加载文件

webview ajax没反应,WKWebView无法触发ajax在本地加载文件

来源:暴趣科技网

我将所有html嵌入到WKWebView中,一直有效,直到我认识到WKWebView无法在本地加载xml文件

$.ajax({

type: "GET",

url: "tags.xml",

dataType: "xml",

cache: false,

success: function(xml) {

},

error: function() {

alert("An error occurred while processing XML file.");

}

});

我的UIWebView代码

//urlFolder is located locally in a temporary file: tmp/www/htmlFolder

//urlFile is located in the urlFolder: tmp/www/htmlFolder/index.html

//xml file is located in the urlFolder: tmp/www/htmlFolder/tags.xml

WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];

_webView = [[WKWebView alloc] initWithFrame:self.view.frame configuration:theConfiguration];

[_webView loadFileURL:urlFile allowingReadAccessToURL:urlFolder];

[self.view addSubview:_webView];

注意:我使用的是XCode7.1 Beta,Objective-C,ios9.1,WKWebView

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- baoquwan.com 版权所有 湘ICP备2024080961号-7

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务