I have a question regarding webview. Some websites do not show data when using the webview in b4j, I think they are looking for a header or something like that and allow access when they see firefox,explorer,chrome etc..
There is a way to add headers when downoading via httpjob but i couldnt find anything for webview. is it possible?
Usually websites find out your browser type via the UserAgent, you can set it with the following code:
B4X:
Sub SetUserAgent(W As WebView, UserAgent As String)
Dim JO As JavaObject = W
JO.RunMethodJO("getEngine",Null).RunMethod("setUserAgent",Array As String(UserAgent))
End Sub
But as billzhan already mentioned this is probably not the problem here.
Dim we,wvjo As JavaObject
we.InitializeNewInstance("javafx.scene.web.WebEngine",Null)
wvjo = WebView1
we = wvjo.RunMethod("getEngine",Null)
Dim useragent As String=$"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0"$
we.RunMethod("setUserAgent",Array(useragent))
WebView1.LoadUrl("http://www.whoishostingthis.com/tools/user-agent/")
Dim we,wvjo As JavaObject
we.InitializeNewInstance("javafx.scene.web.WebEngine",Null)
wvjo = WebView1
we = wvjo.RunMethod("getEngine",Null)
Dim useragent As String=$"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0"$
we.RunMethod("setUserAgent",Array(useragent))
WebView1.LoadUrl("http://www.whoishostingthis.com/tools/user-agent/")
tried all but these are not working as it works in the chrome. I couldnt exactly understand what phantomjs or selenium is for but i will search them on the web.