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 ??
Asked
Active
Viewed 4,176 times
2 Answers
3
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.
![](../../users/profiles/4532684.webp)
MantasG
- 185
- 1
- 1
- 11
-2
These two lines worked for me...
wv.getSettings().setAllowFileAccessFromFileURLs(true);
wv.getSettings().setAllowUniversalAccessFromFileURLs(true);
![](../../users/profiles/3374362.webp)
Nevaeh
- 1,359
- 6
- 20
- 40