viewport_width -- token?

Questions about the WURFL Cloud service.
astanley
Posts: 2
Joined: Tue Jan 07, 2014 1:21 pm

viewport_width -- token?

Postby astanley » Tue Jan 07, 2014 1:36 pm

Unfortunately I'm not finding the WURFL API as intuitive as everyone claims. Can someone give me a couple of solid php and related javascript examples of how to implement the viewport_width and provide a more thorough description of virtual functions and the token? Much appreciated thanks.

sm_support2
Posts: 294
Joined: Mon Jun 20, 2011 5:04 pm

Re: viewport_width -- token?

Postby sm_support2 » Tue Jan 07, 2014 4:32 pm

Hi, can you please elaborate on what you are trying to achieve?

what capabilities you are using, what are your expected results and how what you are getting is different from what you expect.

Thanks

astanley
Posts: 2
Joined: Tue Jan 07, 2014 1:21 pm

Re: viewport_width -- token?

Postby astanley » Tue Jan 07, 2014 5:27 pm

As mentioned, I am using the viewport_width capability, and I'm getting a return string as "device_width_token". I note there are 4 possibilities that can be returned in the viewport_width capability documentation found here: http://wurfl.sourceforge.net/help_doc.php. Please elaborate on these.

This issue began on a mobile site I'm designing when the iphone and android both output two small strips of white space (perhaps 10 pixels or so) on the top and left side (bottom and left side for android), which prevents the page from aligning perfectly. I would really appreciate someone explaining how viewport width differs from resolution width and how to correctly apply each so I can correct this error. I have tried about 12 different fixes, with many unrelated to WURFL including width 100% on html, body, and wrapper divs (with border box applied and not), as well as meta viewport statements to correct the issue. Nothing has worked so far. The reason I purchased WURFL is to accurately detect a device's resolution, and format the page accordingly. Thanks.

sm_support2
Posts: 294
Joined: Mon Jun 20, 2011 5:04 pm

Re: viewport_width -- token?

Postby sm_support2 » Tue Jan 07, 2014 6:09 pm

The 'viewport_width' capability indicates which string is recommended to force a mobile rendering of the HTML page. Several combinations are possible, but all modern smartphones (including iOS and Android with the respective stock browsers) are typically best served with the following viewport meta-tag:

<meta name="viewport" content="width=device-width">

If you use our Cloud product to query the 'viewport_width capability' and the "device_width_token" value is returned, the line above is what you should generate to tell your browser that it is displaying a mobile page and that a certain number of pixels (normally 320, but beware of physical vs. CSS pixels for advanced usages!) is the page width.

Assuming you have done that, extra whitespace you find in the page is most likely due to CSS values (or lack thereof) that you set elsewhere. I doubt this is a issue with WURFL. Also, I am not sure what your programming background is, but mobile web pages tend to offer less pixel-perfect control than, for example, apps.

If you post a link to the offending page, we may take a look and see if there's any obvious mistake, but this seems like an HTML issue that is outside of WURFL's domain.

Thanks


Who is online

Users browsing this forum: No registered users and 26 guests