如何处理HTML文件中的scriptlet,而不是显示纯文本? [英] How to process scriptlets in my HTML file instead of them showing plain-text?

查看:77
本文介绍了如何处理HTML文件中的scriptlet,而不是显示纯文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何获取HTML来处理看起来像<?= var data = getData()?>的扩展名/调用方(脚本).这是我的脚本代码链接.

I can't figure it out how I can get the HTML to process the extension/caller (scriptlets) that look like this <?= var data = getData()?>. Here is my script code link.

请检查我的错误:

推荐答案

从我的回答此处:

如果使用HTMLService进行评估时,HTML文件中包含<?...?>脚本,则需要使用createTemplateFromFile(),否则它们将被视为纯文本. createHTMLOutputFromFile()无法用于评估脚本标签.

If you have the <?...?> scriptlets in your HTML file when you evaluate with the HTMLService you need to use createTemplateFromFile() otherwise they will be treated as plain text. The createHTMLOutputFromFile() won't work for evaluating the script tags.

function doGet() {
 return HtmlService.createTemplateFromFile('Index').evaluate();
}

您应该查看 HTMLService最佳做法进行异步加载.

You should take a look at the HTMLService best practices for async loading.

这篇关于如何处理HTML文件中的scriptlet,而不是显示纯文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆