【发布时间】:2015-01-01 04:51:13
【问题描述】:
我有这个简单的脚本来获取一个页面并将其输出不变。但是,浏览器不会将输出识别为 HTML 并将其显示为文本。
function doGet(e) {
var url = e.queryString || "";
if (url != "") {
return getPage(url);
}
return "not found";
}
function test() {
return 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();
return ContentService.createTextOutput(html).setMimeType(ContentService.MimeType.HTML);
}
怎么了?如何将获取的页面输出为 HTML?
【问题讨论】:
-
嗯,HTML 不在有效的 mime 类型列表中:developers.google.com/apps-script/reference/content/mime-type
标签: html google-apps-script web-applications