it's getting loaded correctly in Chrome, but it gets a 403 error in a WebView
i suspect the web server is expecting some header for a proper browser request
i already tried setting a standard user-agent but with no different outcome
B4X:
Dim m As Map
m.Initialize
m.Put("User-Agent","Mozilla/5.0 (Windows; U; Windows NT 6.1; zh_CN) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0 baidubrowser/1.x Safari/534.7")
Dim r As Reflector
r.Target = WV_meteowidget
r.RunMethod4("loadUrl", Array As Object(url, m), Array As String("java.lang.String", "java.util.Map"))
1) Add the chrome client to the webview as mentioned in my signature tip #1
2) Load the url into webview using it's regular .LoadURL method instead of using relfection:
B4X:
Wv.LoadURL = UrlToLoad
3) Yes, my above suggestion does not set the useragent, but first see if it works as is, if not then you can use the webviewsettings lib to set it:
B4X:
Dim UA As String
UA = useragentstring
wvs.setUserAgentString(wv,UA)
*** Also, I noticed that you didn't set the "URL" variable to anything in the code you posted if that might be the cause of your error.
Hi all. WebViewExtras is my latest library. It's a much updated version of JSInterface. WebViewExtras exposes more of the available native Android WebView methods to your B4A application: addJavascriptInterface(webView1 As WebView, interfaceName As String) Add a javascript interface to...
well, it actually hasn't worked, because I still get the same 403 error, but using the WebViewExtras capability of extracting resulting HTML, I was able to intercept the error and open a full browser instead
thank you
This is a long shot (because normally you would have received a different error message if this was the cause), but try adding this line to your apps manifest: