Hi, I'm new to the forum and I'm learning with B4A sorry if the questions may seem trivial.
As the title suggests, I would like to view the Desktop version of a site with the WebView tool, I followed this Thread:
Thanks for the reply, I put this code but it always opens the mobile site, where am I wrong?
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
Dim Obj1 As Reflector
Obj1.Target = WebView1
Msgbox(Obj1.ToString, "Target")
Obj1.Target = Obj1.RunMethod("getSettings")
Msgbox(Obj1.ToString, "Settings")
Msgbox(Obj1.RunMethod("getUserAgentString"), "User agent")
Obj1.RunMethod2("setUserAgentString", "Desktop", "java.lang.String")
WebView1.LoadUrl("https://www.b4x.com/android/forum/")
End Sub
I checked the thread I put this code but when I start the app it closes
B4X:
Dim jo As JavaObject = WebView1
Dim settings As JavaObject = jo.RunMethod("getSettings", Null)
settings.RunMethod("setUseWideViewPort", Array(True))
settings.RunMethod("setLoadWithOverviewMode", Array(True))
It will allow you to set various settings like the user agent, wideviewport, overviewmode using regular methods instead of using a java object (like you did in the previous code above).
Thanks, with the address https://www.b4x.com/android/forum/ it works but if I put the address I want it comes out written Browser not supported we recommend to use the following Browsers: Google Chrome, Mozilla Firefox, Opera, Microsoft Edge, Safari.
Is there a way to solve it?