JavaScript Browser Navigate to Url

Apr 16, 2020
window.location.href = 'https://www.google.com'

NOTE: You can use window.location = 'https://www.google.com' or window.location.assign('https://www.google.com') as well.

location = 'http://www.example.com' is a synonym of location.href = 'http://www.example.com'. - Source

window.location.replace('https://www.google.com') will clear the back history.

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.