freeCodeCamp/guide/russian/javascript/tutorials/get-current-url-in-javascript/index.md

15 lines
544 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Get Current Url in JavaScript
localeTitle: Получить текущий URL в JavaScript
---
Чтобы получить **текущий URL-адрес** :
```
var url = window.location.href;
```
Чтобы получить **текущий путь** :
```
var path = window.location.path;
```
Более подробную информацию о объекте местоположения и его свойствах можно найти [здесь](https://developer.mozilla.org/en-US/docs/Web/API/Window/location) .