01.26.11

document.location vs document.location.replace

Posted in Programming at 2:38 pm by Toby

document.location.replace(‘http://mysite.example.com/myurl.html’)

seems to replace (!) the contents of the window, and although it replaces the url in the address bar it doesnt really refresh the page as you will notice if you try the back button as it will look like you are going two pages back.

document.location = ‘http://mysite.example.com/myurl.html’

will go to the new location.

Comments are closed.