Safari Javascript issue

Hi experts,

The following code works fine with other browsers but Safari

<input type="button" value="Cancel" OnClick="window.navigate('cohindex.php');" >

(OnClick="window.open('cohindex.php');"  works but it opens a new window which is not what i want)

Your help is highly appreciated.
Kind regards
Corona880Asked:
Who is Participating?
 
Albert Van HalenAnalyst developerCommented:
Use window.location.href = 'cohindex.php';
0
 
jhp333Commented:
window.open('cohindex.php', '_self')
will load the new page on the current window.

or you can also do:
window.location.href='cohindex.php';
0
 
Gurvinder Pal SinghCommented:
using an anchor tag would have simplified a lot
<a href='cohindex.php'>

but i guess since it is a php (a server side) script, you need to submit to it rather than just navigate to it.

<input type="button" value="Cancel" OnClick="cancel()" >

function cancel()
{
   document.forms[0].action = "cohindex.php";
   document.forms[0].submit();
}
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.