Export to GitHub

google-caja - issue #1632

Meta tag defining viewport not rendered


Posted on Jan 25, 2013 by Happy Cat

What revision of the cajoler exhibits the problem? On what browser and OS? Current version as of Jan 24 2013 (I don't know how to tell the version) Experienced using default web browser 2.3.6 on Android Nexus One as well as firefox on Android Nexus One.

What steps will reproduce the problem? 1. Embed the following in a webpage: <meta name="viewport" content="user-scalable=no, width=device-width" />

What is the expected output? What do you see instead?

The screen should appear zoomed and I should not be able to scroll right. Unfortunately, the screen appears zoomed out and I can scroll right. Not conducive to development of mobile web apps.

Please provide any additional information below.

I tested the same line of code on a html file that I read from my sdcard and experienced the desired behavior, so it's not a limitation of the phone-I think caja is somehow messing with meta tags.

Comment #1

Posted on Jan 25, 2013 by Helpful Cat

Caja is designed to provide guest content a portion of a page, somewhat like an iframe. Therefore, as a general rule, it cannot make declarations which affect the display of the entire page. In order to have this feature you would have to have the host page explicitly permit it in some way.

One way that could be done now without changes to Caja is to simply copy the virtualized declaration into a real one. In the Caja-generated HTML for your example, you will find this:

Simply copy this piece of the DOM while stripping off the virtualization prefixes and you will get the effect you are asking for. To ensure this is not by itself a security breach due to possible extensions of the viewport declaration, I recommend using a whitelist for the specific content= values or patterns you expect to use.

If you would like us to support this explicitly, then please give more information about your use case so that we can design an appropriate API. Is there anything besides meta viewport that you would want to be propagated to the entire page? What is the layout of your host page such that this makes sense to do?

Comment #2

Posted on Jan 25, 2013 by Happy Cat

My goal is to create a web app that works well for mobile devices using google apps scripts. So, if I understand how google apps script works, I think this would need to be supported explicitly.

To see what I'm trying to do in action, go to:

https://script.google.com/macros/s/AKfycbwcr0jbrgRPeHUqyr0FbSNMGG5ZbHNkZmePiFxt8Nx8Bl0lXXI/exec

Comment #3

Posted on Jan 25, 2013 by Helpful Cat

Since page-wide effects such as viewport are a matter of the container's policy, I recommend that you file a feature request with the container, i.e. Google Apps Script.

Do cross-reference this issue so that we can reopen it to coordinate any necessary work.

Status: WontFix

Labels:
Type-Enhancement Priority-Medium