Nest all content into snippets
This commit is contained in:
20
snippets/js/s/current-url.md
Normal file
20
snippets/js/s/current-url.md
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
title: Current URL
|
||||
type: snippet
|
||||
language: javascript
|
||||
tags: [browser]
|
||||
cover: tropical-bike
|
||||
dateModified: 2020-10-20T11:46:23+03:00
|
||||
---
|
||||
|
||||
Returns the current URL.
|
||||
|
||||
- Use `Window.location.href` to get the current URL.
|
||||
|
||||
```js
|
||||
const currentURL = () => window.location.href;
|
||||
```
|
||||
|
||||
```js
|
||||
currentURL(); // 'https://www.google.com/'
|
||||
```
|
||||
Reference in New Issue
Block a user