Android Question Vebview force ,mobile version

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Guys

What is the best way to force webview to display contents as a mobile page instead of desktop version
 

ronell

Well-Known Member
Licensed User
Longtime User
i think its not possible, some html5 codes dont work in webview(depends on ur android OS version)
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
Thanks for all your replies
WebView should show the mobile version automatically.
On Samsung Tab8, Webview shows the desktop version all the time. I believe it does the same on any high resolution screen
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
blame that site for not being responsive.

Thanks for your feedback

Here is what I am trying to understand

Samung Tab 8
if I try b4x.com, i get the mobile version, if I click community I get the desktop version

Moto G
if I try b4x.com, i get the mobile version, if I click community I get the mobile version

Same website, different devices. How can I force community to show as mobile version on Samsung Tab 8?
 
Upvote 0

An Schi

Well-Known Member
Licensed User
Hmm, you probably can't force the webview.
You have to work on the homepages code to force the homepage to go into mobile mode.
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
Hmm, you probably can't force the webview.
You have to work on the homepages code to force the homepage to go into mobile mode.

Thanks for your feedback.
I am sure what you are suggesting is possible, however it becomes page dependent and not a generic solution that we can assume that it will work all the time.

I have seen many posts referring to "setUserAgentString", did anyone get this to work properly
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
this forum exept the top menu in black is responsive so I don't know what you mean with desktop and mobile versions.

it probably looks like desktop because your samsug tablets resolution is bigger/wider than the Moto G's ?
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
this forum exept the top menu in black is responsive so I don't know what you mean with desktop and mobile versions.

it probably looks like desktop because your samsug tablets resolution is bigger/wider than the Moto G's ?

Sorex, you are absolutely right. The samsung tab resolution is high, so the forum looks similar to desktop layout.
That's exactly, what I am trying to avoid.

Say, I would like to display the forum on Samsung Tab in a Webview with the same layout as it is showing on Moto G.
What are my options?
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
I think the only option is putting an iframe in the webview and load the page with a fixed width smaller than the viewport.

But that doesn't make sense at all to use only 66% of you screen to have similar looks as on a lower resolution device.

If this is for your own website you better work with a fixed grid system instead of going responsive worst that can happen then
is that it zooms out too much which gives small text or you get horizontal scrolling.
 
Upvote 0

An Schi

Well-Known Member
Licensed User
If you are working with a CMS like wordpress you could make "two" webpages which are fed by the same db so you only have to publish once. Use one for normal and the other on a sub url for mobile. On the sub url one delete the desktop theme and only install a mobile theme. Then point your webview to the sub url.
This is not tested, just played with it in my mind....

But that doesn't make sense at all to use only 66% of you screen to have similar looks as on a lower resolution device.

Could make a little sense if you use the other 33% to display some kind of navigation. You could try making the webview smaller to display the mobile version and then use the rest of the space to display navigation or something else with native b4x code...
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
If you are working with a CMS like wordpress you could make "two" webpages which are fed by the same db so you only have to publish once. Use one for normal and the other on a sub url for mobile. On the sub url one delete the desktop theme and only install a mobile theme. Then point your webview to the sub url.
This is not tested, just played with it in my mind..

Thanks for the suggestion. I do like this idea, let me check with our web developers, hopefully this will solve the issue for us.

Thanks a lot
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
the point of responsive is write once fit all. so if you make your site responsive with only 2 varients you could solve your issue.

on the other hand...

resolutions of mobile are becoming so big that they already will show it desktop like. (1080x1900 HD is common these days? most grid were 960px for desktop versions)
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
indeed, didn't think about that yet ;)

but then he better points to a sub version where the mobile display rules count for everything bigger than 1px width.
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
I guess iCabs point is to transform his existing page into an app instead of making a seperate native app :p;)

Let me clarify the actual point. ;)
Try loading this forum on an 8" high resolution tablet vs a small phone and see which one is more readable for someone sitting in a vehicle.
Also try converting this forum to an app, instead of being able to use it with a quick twist. Which approach, would you take?, would you rather spend 2 years writing an equivalent app?

Thanks again for all your input
 
Upvote 0
Top