Android Question Webview Desktop-mode problem

FrankDev

Active Member
Licensed User
Longtime User
Hi

I have a problem with webview.

Want to switch to desktop view.
I tried' webViewSetting. setUserAgentString (WebViewInfo,"Desktop")' but it doesn't work. The web pages are still displayed in mobile mode.

If I try Chrome (for android) then it works fine.

what else could you try?

regards Frank
 

FrankDev

Active Member
Licensed User
Longtime User
Hi, Erel,

after I knew that you need the' UserAgent' to switch, I tried several strings of course.
However, only the mobile websites are still displayed. Maybe I have set something else wrong or used the wrong switch?

regards Frank
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Are you sure that it is not a site with a responsive design (most are)? Such sites do not use the user agent to distinguish between the different layouts.

Try this:
B4X:
Dim jo As JavaObject = WebView1
Dim settings As JavaObject = jo.RunMethod("getSettings", Null)
settings.RunMethod("setUseWideViewPort", Array(True))
settings.RunMethod("setLoadWithOverviewMode", Array(True))
 
Upvote 0

FrankDev

Active Member
Licensed User
Longtime User
Hi Erel,

almost good..
worked with

webViewSetting.setLoadWithOverviewMode(WebViewInfo,True)
webViewSetting.setUseWideViewPort(WebViewInfo,True)

at least on some pages.
but I still have a few pages that use chrome (android) to switch to standard view... still not yet in the webview.
for example.
www.sgbbm.de
 

Attachments

  • ok.jpg
    ok.jpg
    203.6 KB · Views: 416
  • wrong.jpg
    wrong.jpg
    149.9 KB · Views: 410
Upvote 0
Top