How can I output HTML from a Google Apps Script? -



How can I output HTML from a Google Apps Script? -

i have simple script page , output unchanged. however, browser doesn't recognize output html , shows text.

function doget(e) { var url = e.querystring || ""; if (url != "") { homecoming getpage(url); } homecoming "not found"; } function test() { homecoming getpage("www.google.com"); } function getpage(url) { var options = { headers : {'cache-control' : 'max-age=0'} }; var response = urlfetchapp.fetch(url, options); var html = response.getcontent(); homecoming contentservice.createtextoutput(html).setmimetype(contentservice.mimetype.html); }

what's wrong? how can output fetched page html?

use homecoming in getpage() function instead:

var html = response.getcontenttext(); homecoming htmlservice.createhtmloutput(html);

however, not expect fetched page "unchanged" - html service sanitize content, may result in page functionality beingness removed or not working.

also maintain in mind web app rendered within iframe - fetched page may not allow run in iframe or employ frame-breakout javascript may result in users beingness redirected away web app actual url of fetched page.

i must ask, though: must render external page way? wouldn't simple <a href="..." target="_blank">link external page (will open in new tab/window)</a> suffice?

google-apps-script

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -