Travis build: 1020

This commit is contained in:
30secondsofcode
2018-01-04 10:35:26 +00:00
parent ef8e9128ab
commit dd62e9fc02
2 changed files with 8 additions and 3 deletions

View File

@ -2012,15 +2012,19 @@ Redirects the page to HTTPS if its currently in HTTP. Also, pressing the back bu
Use `location.protocol` to get the protocol currently being used. If it's not HTTPS, use `location.replace()` to replace the existing page with the HTTPS version of the page. Use `location.href` to get the full address, split it with `String.split()` and remove the protocol part of the URL.
<details>
<summary>Examples</summary>
```js
const httpsRedirect = () => {
if (location.protocol !== 'https:') location.replace('https://' + location.href.split('//')[1]);
};
```
<details>
<summary>Examples</summary>
```js
httpsRedirect(); // If you are on http://mydomain.com, you are redirected to https://mydomain.com
```
</details>
<br>[⬆ Back to top](#table-of-contents)