Is there anyway to add meta tags to html header when creating a web app using the ui service on Google app scripts?
To add an HTML file to your Apps Script project, open the Script Editor and choose File > New > HTML File. Within the HTML file, you can write most standard HTML, CSS, and client-side JavaScript. The page will be served as HTML5, although some advanced features of HTML5 are not available, as explained in Restrictions.
Google Apps Script is a rapid application development platform that makes it fast and easy to create business applications that integrate with Google Workspace. You write code in modern JavaScript and have access to built-in libraries for favorite Google Workspace applications like Gmail, Calendar, Drive, and more.
Google Apps Script allows us to use jQuery, which is the preferred technique in HTML programing to date.
google. script. run is an asynchronous client-side JavaScript API available in HTML-service pages that can call server-side Apps Script functions. To interact with dialogs or sidebars in Google Docs, Sheets, or Forms from client-side code, use google.
Quoting from Caja Issue 1632, Meta tag defining viewport not rendered:
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.
Since Google uses Caja sanitization for UI and HTML service pages, and wraps the sanitized output as a <div>
within its own host page, Google Apps Script would need to explicitly permit setting of the meta tags.
Unfortunately, that isn't supported in the Google Apps Script APIs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With