最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to disable web security when using angularjs in android webview? - Stack Overflow

programmeradmin4浏览0评论

I'm creating an android application in which i want to use angularjs for displaying html contents in my webview.Its not working normally.I just realized that i should disable web security option since it worked in chrome when i did that.Could anyone tell me how to do that ??

I'm creating an android application in which i want to use angularjs for displaying html contents in my webview.Its not working normally.I just realized that i should disable web security option since it worked in chrome when i did that.Could anyone tell me how to do that ??

Share Improve this question asked Oct 17, 2014 at 5:38 NevaehNevaeh 1,5697 gold badges24 silver badges45 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 5
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setAllowFileAccessFromFileURLs(true);
webView.getSettings().setAllowUniversalAccessFromFileURLs(true);

These lines enable cross origin requests for file:// protocol but it requires API level at least 16.

These two lines worked for me...

wv.getSettings().setAllowFileAccessFromFileURLs(true);
wv.getSettings().setAllowUniversalAccessFromFileURLs(true);
发布评论

评论列表(0)

  1. 暂无评论