EDITABLE CODE:
LiveDemo: JavaScript Location Object : replace() Method
Note: The timer is used to insert a delay of 1 sec after which the page is loaded.