Service

Access and manipulate script publishing.

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/script/service#getUrl()` | `String` | Returns the URL of the web app, if it has been deployed; otherwise returns `null`. |
| `https://developers.google.com/apps-script/reference/script/service#isEnabled()` | `Boolean` | Returns `true` if the script is accessible as a web app. |

### Deprecated methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/script/service#disable()` | `void` | Disables the script from being accessed as a web app. |

## Detailed documentation

### `getUrl()`

Returns the URL of the web app, if it has been deployed; otherwise returns `null`. If you
are running the development mode web app, this returns the development mode url.

```javascript
// 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()}`,
);
```

#### Return


`String` --- The URL of the web app.

*** ** * ** ***

### `isEnabled()`

Returns `true` if the script is accessible as a web app.

#### Return


`Boolean` --- `true` if the script is published as a web app; `false` if not.

## Deprecated methods

### `disable()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Disables the script from being accessed as a web app. This method is equivalent to opening the
"Publish \> Deploy as web app" dialog and clicking "disable web app".

```javascript
ScriptApp.getService().disable();
```