# getProtocol

Canonical: https://www.wiki.jodisand.me/snippets/javascript/getprotocol/


Gets the protocol being used on the current page.

- Use `Window.location.protocol` to get the protocol (`http:` or `https:`) of the current page.

```js
const getProtocol = () => window.location.protocol;
```

```js
getProtocol(); // 'https:'
```


