jadjoubran / codetogo.io

🚀 JavaScript code to go - Find updated snippets for common JavaScript use cases
https://codetogo.io
MIT License
233 stars 30 forks source link

Use Case Suggestion: How to find URL browser with BOM in JavaScript #151

Closed politologu closed 6 years ago

politologu commented 6 years ago

alert(location.href); // shows current URL if (confirm("Go to codetogo?")) { location.href = "https://codetogo.io/"; // redirect the browser to another URL }

jadjoubran commented 6 years ago

Thanks @politologu There's a similar use case that allows you to get the current page URL and for changing it, it's kinda the same variable which you need to change Thanks!

politologu commented 6 years ago

omg sorry :)

jadjoubran commented 6 years ago

No worries 😄