17 lines
241 B
Markdown
17 lines
241 B
Markdown
---
|
|
title: currentURL
|
|
tags: browser,beginner
|
|
---
|
|
|
|
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/'
|
|
```
|