返回 Web 应用的网址(如果已部署);否则返回 null。如果您运行的是开发模式 Web 应用,则此方法会返回开发模式网址。
// Mail the URL of the published web app.MailApp.sendMail('myself@example.com','My Snazzy App',`My new app is now available at ${ScriptApp.getService().getUrl()}`,);
返回
String - Web 应用的网址
isEnabled()
如果脚本可作为 Web 应用访问,则返回 true。
返回
Boolean - 如果脚本作为 Web 应用发布,则为 true;否则为 false
已弃用的方法
disable()
已弃用。此函数已废弃,不应在新脚本中使用。
禁止以 Web 应用的形式访问脚本。此方法等同于打开“发布 > 以 Web 应用形式部署”对话框,然后点击“停用 Web 应用”。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-12-22。"],[[["The `ScriptApp` service allows you to control and interact with the deployment of your script as a web application."],["You can retrieve the web app's URL using `getUrl()`, check its accessibility status with `isEnabled()`, and previously, disable it using the now deprecated `disable()` method."],["The `disable()` method has been deprecated and should no longer be used in new scripts, replaced by the \"Publish \u003e Deploy as web app\" dialog for disabling."],["When deploying your script as a web app, you can use provided methods to obtain its URL and determine if it's enabled for access."]]],[]]