Five ways to navigate
Here are five ways to navigate using Javascript snippets.
- The first will read in the new URL, over or instead of the current
- The second will send you to the new URL.
- The third will load an URL in the same broser tab that you already have open
- The fourth will reload the current page
- The fifth will also reload the current page
So, as you see there are a few ways to do thing, but they mainly do the exact same. Open a new page for you, or reload the page where you already are.
HTML
<A HREF='javascript:location.replace("https://dev.webpages.dk")'>Load page</A>
<A HREF='javascript:window.location.assign("https://dev.webpages.dk")'>Load page</A>
<A HREF='javascript:window.location.replace("https://dev.webpages.dk")'>Load page</A>
<A HREF='javascript:location.reload()'>Reload page</A>
<A HREF='javascript:location.reload(true)'>Reload page</A>
Javascript
location.replace("https://dev.webpages.dk");
window.location.assign("https://dev.webpages.dk");
window.location.replace("https://dev.webpages.dk");
location.reload();
location.reload(true);