Search code examples
javascriptgoogle-chromeinternet-explorer-9locationhref

The document.location.href is not working in Chrome browser


The command:

document.location.href="www.google.com" 

Does not change the current web page in the google chrome browser. The command does transfer the page in the IE9 browser.

Why would this command work for IE9 but not for chrome?


Solution

  • An alternative solution is to add this line before document.location.href

    window.event.returnValue = false;
    

    Source: document.location does not change the webpage in IE9?