Free Photos
WordPress Themes

Javascript window.location

<script type="text/javascript"> <!-- window.location = "http://www.example.com/"; //--> </script>

1 Response

Perhaps this changed since 2011:

window.location.host
"codepad.co"
window.location.hostname
"codepad.co"
window.location.href
" https://codepad.co/snippet/b4798e"
window.location.origin
" https://codepad.co"
window.location.pathname
"/snippet/b4798e"

Also:
document.URL
" https://codepad.co/snippet/b4798e"

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.