← Back to team overview

ubuntu-phone team mailing list archive

Re: Webapp Question & Nexus Calls

 

Thanks Olivier, that last might be the way to go. I've created several webapps of sites I use daily - Australian banks, news, online arts journal, etc. I won't have any control of the content in these apps - I'm just creating something to easily view them. Unfortunately, mobile banking sites opened on a desktop web browser still end up being mobile banking sites - they suck. Will have a play with the link to the QML code below, and see what I come up with. As webapps seem to be such a big part of the Ubuntu user story, it would be great to have some easily definable way to choose a mobile site or desktop site, based on the end-users device.

Cheers,

Mitchell

On 22/08/14 18:53, Olivier Tilloy wrote:



On Fri, Aug 22, 2014 at 9:27 AM, <daniel.beck@xxxxxxxxx <mailto:daniel.beck@xxxxxxxxx>> wrote:

    Hi Mitchell,

    you could use media queries to adapth to the size of the display:

    @media screen and (orientation: portrait) {
         body { background-color: white; }
       }

    This can also be used with Javascript.

    Link:
    https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries


As suggested by Daniel, the best solution, if you have any control over the contents of the webapp itself, is to build it with dynamic layouts that adapt to the available viewport.

Otherwise, the content you’ll get will probably be determined by the user-agent that the webapp container is sending to the server, which on devices (currently all touch devices regardless of their screen size) contains the "Mobile" and "like Android" tokens, which in most cases will get you mobile content.

If you need to send a different user agent based on specific conditions, I’d recommend building a QML app that embeds an Ubuntu WebView, see documentation there: http://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Web.WebView/#getUAString-method.

HTH,

 Olivier



Follow ups

References