Fixed previousUrl value

When using browser's back button, the previous url value was not good (document.location was the url we are going to). So, when calling goto when browser history is changed, we will pass the previous url.