Fix window.location mistakes in previous code

Sorry guys, I commit the incomplete code. It should be window.location.assign(url);

However this is just tested in google chrome.
Merge pull request #1979 from maelzx/patch-2

Fix window.location mistakes in previous code