View Full Version : javascript window redirect doesn't work in chrome ((canceled) - status )

12-21-2011, 03:19 PM
Hi there,

I hope I post this in the right section.

I'm trying to do a redirect using the below code:
<script type="text/javascript">
window.location.href = "http://google.com"

FF and IE work as they should. Chrome doesn't.

The request above to http://google.com, gets a 'canceled' status in Chrome browser > Development tools > "Network".

I've tried several other functions:
location.href = url
document.location = url
window.open(url, '_self')

Same code pasted within a local html file works fine.

Below is the redirect request that it's canceled by chrome: http://pastebin.com/hD36M1RG

Any clues? Thanks

Philip M
12-21-2011, 04:54 PM
It must be the settings in your Chrome browser.

Better to use http://www.google.com

There were lots of examples of poor defending, both prior to and preceding the goal. - Sports Commentator

12-21-2011, 05:26 PM
Thanks for your reply.

It doesn't matter if I use www.google.com or google.com only. That's just an example. It doesn't work regardless of the redirect URL.

Also, if its a Chrome setting, then it shouldn't have been worked, when I just used the code in a local html file, but it did.

Philip M
12-21-2011, 07:45 PM
I looked at Google for this problem, and some posts suggested malware. Clear your browser cache, run Malwarebytes or similar and then try again.

12-22-2011, 02:01 AM
Neah, I've tried this also, in a virtualbox, windows xp. Same results.