我想在我的Google网站上添加ShareThis.com的一些共享按钮。 ShareThis创建此代码以包含在head部分中:
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript" src="http://s.sharethis.com/loader.js"></script>
为了进入我的Google网站,我用Google-Apps-Script编写了这个程序并执行它:
function myFunction() {
var headers = {"A": "<script type=\"text/javascript\">var switchTo5x=true;</script>",
"B": "<script type=\"text/javascript\" src=\"http://w.sharethis.com/button/buttons.js\"></script>",
"C": "<script type=\"text/javascript\" src=\"http://s.sharethis.com/loader.js\"></script>"};
UrlFetchApp.fetch("sites.google.com/site/mysitename/home",
{"headers": headers, "method": "post"});
}
没有出现错误消息,但它不会显示该站点的源代码。
有人能给我一个暗示吗?
Google不允许编辑头部。免费服务有其局限性。耻辱。我想添加一些脚本。