17 lines
242 B
Markdown
17 lines
242 B
Markdown
---
|
|
title: getProtocol
|
|
tags: browser,beginner
|
|
---
|
|
|
|
Returns the protocol being used on the current page.
|
|
|
|
- Can be either `http:` or `https:`
|
|
|
|
```js
|
|
const getProtocol = () => window.location.protocol;
|
|
```
|
|
|
|
```js
|
|
getProtocol(); // 'https:'
|
|
```
|