Issue
I'm loading an HTML file from the SD card with android's WebView.loadUrl()
method.
this html file contains JavaScript functions, souch as someFunction()
.
from some reason I stil don't understand, calling to mWebView.loadUrl("javascript:someFunction()");
don't "trigger" the function in the HTML file. (I'm calling it after the html finished loading...)
when I'm loading to the web view the same HTML file from remote server, and launch the same javascript call from the webView - it does work! so I know the problem got something with the fact that I'm loading it from local file, and not a bug in my html file.
I know about the need to enable javascript:
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
it doesn't help!
I've noticed also that there is the same problem with the WebViewClient.onLoadResource()
callback. it seems like I have general problem with the javascript when the files are local, and not from remote-server (or accessed from HTTP Web Server's uri, to be exact).
any suggestions why it happening, and what I need to do to make it work?
TIA
Solution
it seems like it is was my mistake. java script functions working even when the html file is on the SD. it was that specific function I used simply didn't worked as accpected from some other reason.
Answered By - Tal Kanel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.