Javascript: Forward user to new page

June 6, 2010

I often find myself needing to forward a user through Javascript for various reasons. Here are a couple quick snippets of Javascript to accomplish that task.

This one is supposed to block the Back button from tracking the change

window.location.replace("http://example.com");
window.location = "http://www.example.com";