window.location.href not working in Safari
27,653
Safari appears to dislike having the return false occur in the function call. If you move it into your onsubmit as onsubmit="openPop(this.action);return false;" then Safari will work without issue.
Edit: To improve the answer, onsubmit itself needs to return false, so openPop returning false is not enough. You could just have it do onsubmit="return openPop(this.action);" though.
Author by
99miles
Updated on April 26, 2020Comments
-
99miles about 4 years
Why won't this work in Safari?
<script language="javascript" type="text/javascript"> function changeUrl(url) { window.location.href='http://google.com'; return false; } </script> <form action="#" onsubmit="changeUrl(this)" /> <input type="Submit" value="Go" /> </form>