Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,988
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,988
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    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.

  • #5
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Neah, I've tried this also, in a virtualbox, windows xp. Same results.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •