WebMasterCampus
WEB DEVELOPER Resources

HTML How to Redirect to Another Webpage

learn how HTML Redirect to Another Webpage


HTML How to Redirect to Another Webpage

Redirection can be easily achieve using HTML. We don’t need JS or jQuery for this basic operation. It’s recommended to use this HTML out of box feature.

You can use any one of following but windows.location.replace is best to simulate an HTTP redirect because it does not keep the originating page in the session history, meaning the user won’t get stuck in a never-ending back-button fiasco.

If you want to generate clicking on a link simulation, use location.href


window.location.replace("https://www.duckduckgo.com");

window.location.assign('https://www.bing.com')

window.location.href = "https://www.mozilla.com";

location.href = 'redirectPage.html';  //since window is Global
Created with love and passion.