How can I make Google Apps Scripts web apps responsive and mobile friendly?

Viewed 5501

I've been trying for a few days to figure out how I can make the web app from my Google App Script work on mobile. The most common solution I've seen is to simply embed the web app into the old version of Google Sites.

Right now the page resizes fine on desktop browsers but as soon as I open it up on mobile it's all zoomed out way too far.

3 Answers

In case you are using HtmlService.createTemplateFromFile(filename) and you use .evaluate(), then you have to do like this:

 var html = HtmlService.createTemplateFromFile(filename);
    var evaluated = html.evaluate();
    evaluated.addMetaTag('viewport', 'width=device-width, initial-scale=1');
    return evaluated

In your Google Site:

  • Scroll down «More actions» gearwheel
  • Click on «Manage site»
  • Go down to «Mobile»
  • Check «Automatically adjust site to mobile phones»

The answer provided by RayB is in case you want to open the published Google Apps Script web app directly in your mobile device and without embedding it in a Blog or a Google Site.

Related