Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-21-2011, 03:19 PM   PM User | #1
geen
New to the CF scene

 
Join Date: Dec 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
geen is an unknown quantity at this point
javascript window redirect doesn't work in chrome ((canceled) - status )

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"
</script>

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
location.replace(url)
document.location = url
location.assign(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
geen is offline   Reply With Quote
Old 12-21-2011, 04:54 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,101
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 12-21-2011, 05:26 PM   PM User | #3
geen
New to the CF scene

 
Join Date: Dec 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
geen is an unknown quantity at this point
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.
geen is offline   Reply With Quote
Old 12-21-2011, 07:45 PM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,101
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
I looked at Google for this problem, and some posts suggested malware. Clear your browser cache, run Malwarebytes or similar and then try again.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 12-22-2011, 02:01 AM   PM User | #5
geen
New to the CF scene

 
Join Date: Dec 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
geen is an unknown quantity at this point
Neah, I've tried this also, in a virtualbox, windows xp. Same results.
geen is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:24 AM.


Advertisement
Log in to turn off these ads.