Tuesday, 28 June 2016

android WebView user-agent (office 365 sharepoint doesn't use mobile view on android)

I am trying to show a office 365 sharepoint  page on an Android tablet (with chrome):


However, buy accessing the same url sometimes my tablet get mobile view (layout) and sometime desktop view (layout).

When it get mobile view the url is :


When it not able to get mobile view the url does not change.


I did some research online, people suggest to use web view to make an app and set webview User-Agent, then server side will return right layout. 



http://stackoverflow.com/questions/8309796/want-to-load-desktop-version-in-my-webview-using-uastring

https://mobiforge.com/research-analysis/webviews-and-user-agent-strings

https://developer.chrome.com/multidevice/user-agent

https://blog.kloud.com.au/2014/11/06/implementing-adfs-v3-0-forms-authentication-in-mixed-environments/

https://webmasters.googleblog.com/2011/03/mo-better-to-also-detect-mobile-user.html


I have made an android app, I have tried several different values for User-Agent, but I always get the desktop layout.

I did another search online,  found that they mentioned that different website react User-Agent differently.  (https://mobiforge.com/research-analysis/webviews-and-user-agent-strings)


I finally got this:

http://sharepoint.stackexchange.com/questions/58928/disable-sharepoint-mobile-in-office-365


They said for office 365, just add “?mobile=1” at the end the URL , it will use mobile view.

after that you will find that you can not change back to desktop view even you try to access different page.

To change it back, then you should apply “?mobile=0” to the URL





No comments:

Post a comment