Last active
March 17, 2016 14:18
-
-
Save kovaldn/5283672 to your computer and use it in GitHub Desktop.
Javascript: window location
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* --------------------- | |
* WINDOW LOCATION | |
* --------------------- | |
* http://javascript.ru/window-location | |
*/ | |
http://www.google.com:80/search?q=javascript#test | |
window.location.hash // '#test' | |
window.location.href // 'http://www.google.com:80/search?q=javascript#test' | |
window.location.hostname // 'www.google.com' | |
window.location.pathname // '/search' | |
window.location.search // '?q=javascript' | |
window.location.assign(url) // загрузить документ по данному url | |
window.location.replace(url) // заменить текущий документ на документ по указанному url | |
window.location.reload([forceget]) // перезагрузить документ. Аргумент forceget - булево значение, если оно true, то документ перезагружается всегда с сервера, если false или не указано, то браузер может взять страницу из своего кэша. | |
window.location.toString() // строковое представление URL | |
// примеры | |
window.location = "http://javascript.ru" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment