Mobile device scalable in Google Apps Script

I made a web app in GAS 400px wide. I would like this to grow to fill the mobile screen on boot, instead of only filling half of the screen (although still using a fixed pixel width).

I've tried using the viewport code below with no luck.

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes" />

      

+4


source to share


5 answers


This has been google url in recent months and functionality has been added, use the .addMetaTag () method.

Example:

<meta name="google-site-verification" content="..."/>
<meta name="viewport" content="..."/>

var output = HtmlService.createHtmlOutput('<b>Hello, world!</b>');
output.addMetaTag('viewport', 'width=device-width, initial-scale=1');

      



Method documentation https://developers.google.com/apps-script/reference/html/html-output#addmetatagname-content

Related forum https://code.google.com/p/google-apps-script-issues/issues/detail?id=4659

+3


source


I had the same issue lately and after some looking around came across a reported issue in the Trackgate of the Googles Caja project http://code.google.com/p/google-caja/issues/detail?id=1632 ...



The reported problem is exactly what you described when you are trying to zoom in on a web page (generated with Google Apps scripts) when viewed through a mobile device. The answer mentions a workaround, but it's hard to follow the instructions and fix the problem.

+1


source


GAS now supports a viewport (as of December 2015).

Example (taken from this link )

var html = HtmlService.createHtmlOutputFromFile('inputpage').setSandboxMode(HtmlService.SandboxMode.IFRAME).addMetaTag('viewport', 'width=device-width, initial-scale=1');

      

+1


source


0


source


Google doesn't seem to think this is a problem. They are considering accessing the extension's metaview. The only alternative I found was to write custom CSS for mobile and sniff it with a media query. See https://code.google.com/p/google-apps-script-issues/issues/detail?id=4659

-1


source







All Articles