I have a javascript function that uses window.location. It works fine in Firefox and internet Explorer, but not in Chrome. I've tested this on both Ubunutu Hardy and Windows Vista. What is the underlying problem, and how can I circumvent it?
You can use location.location. assign.
Collect network logsOn the affected device, enter chrome://network in the address bar. At the top, click Network logs. Under Network debugging, select the correct debug mode. Open a new tab and reproduce the issue.
The Location. assign() method causes the window to load and display the document at the URL specified. After the navigation occurs, the user can navigate back to the page that called Location.
Window Location Href The window.location.href property returns the URL of the current page.
The most common use of window.location
is to make the browser load a new page. A common error is to assign the URL to the window.location
object instead of it's property href
. So, the correct way to do it is:
window.location.href = 'http://www.guffa.com';
Try appending "return false;" to your javascript call like so...
window.location.href='google.com;
return false;
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