Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does caja sanitization of Google Apps Script htmloutput fail on particular strings
    primarykey
    data
    text
    <p>I am trying to prepare GAS code samples for embedding in Google Sites and other web sites. I use the HtmlService.createHtmlOutput and HtmlService.createTemplateFromFile() and template.evaluate().getContent() to serve up an html version of the content of a google apps script. That all works fine as per <a href="http://excelramblings.blogspot.co.uk/2012/11/publishing-google-apps-script-code.html" rel="nofollow">this post</a>.</p> <p>Now I would like to prettify the code using prettyify.js. Im using the version <a href="http://code.google.com/p/google-caja/source/browse/doc/cajajs/prettify/?r=4554" rel="nofollow">embedded in caja</a> and it almost works. However particular method names in the code being prettified throw an error from htmlservice.</p> <blockquote> <p>Untaming of guest constructed objects objects unsupported. Expect a function not a string : pln</p> </blockquote> <p>Specifically, this text is successfully prettified, </p> <pre><code>function xisItHtml (e) { return ( e.parameter.hasOwnPropertu('template')) ; } </code></pre> <p>whereas this throws an error</p> <pre><code>function xisItHtml (e) { return ( e.parameter.hasOwnProperty('template')) ; } </code></pre> <p>It seems that specific methods (strange because none of this code is being executed, just prettified), cause caja sanitation to complain.</p> <p>The code in the template is just this</p> <pre><code>$(document).ready(function () { // any jQueryness can happen here... try { prettyPrint(); } catch(err) { alert("failed prettification " + err); } }); </code></pre> <p>I'm pretty much stumped. any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload