在不同网站上部署 Google 个 Apps 脚本
Deploying Google Apps Scripts on different websites
我开发了一个 Google 脚本,但它是一个应该放在几个 Google 站点页面上的脚本,我希望能够知道使用脚本哪个网站加载了我的脚本。
脚本如何识别加载了哪个页面?
在作为小工具插入 Google 站点的网络应用程序中,要获取站点名称,我们可以使用 getActiveSite() to get the Site object representing the active site and then getName(),类似于以下内容:
var mySite = SiteApp.getActiveSite();
var mySiteName = mySite.getName();
我开发了一个 Google 脚本,但它是一个应该放在几个 Google 站点页面上的脚本,我希望能够知道使用脚本哪个网站加载了我的脚本。
脚本如何识别加载了哪个页面?
在作为小工具插入 Google 站点的网络应用程序中,要获取站点名称,我们可以使用 getActiveSite() to get the Site object representing the active site and then getName(),类似于以下内容:
var mySite = SiteApp.getActiveSite();
var mySiteName = mySite.getName();