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
You did something that made loading the data unnecessary. (i.e. you started loading a iframe, then changed the src or overwrite the contents)
window. location is an object that holds all the information about the current document location (host, href, port, protocol etc.). location. href is shorthand for window.
The window.location.href property returns the URL of the current page.
Try without window.
, it helped in my case. I had used location.assign()
instead of window.location.assign()
and worked.
I was doing the same thing. A quick patch was to add a little delay before the redirect using setTimeout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With