I am having some browser compatibility problems with what I am trying to do here.
I have a form on a webpage :
<form method="POST" target="_blank"
onsubmit="refreshparent()" action="https://processor.com/payment.php" >
<input type="HIDDEN" name="unit_key" value="92393d" >
<input type="HIDDEN" name="cost" value="100.20" >
<input type="HIDDEN" name="user_id" value="92393d" >
<input type="SUBMIT" name="SUBMIT" value="Click to open payment site" >
</form>
When the user submits the form, I want a new window to open and I want a javascript function called “refreshparent” to get called.
<script type="text/javascript">
function refreshparent()
{
alert("test");
window.location.replace ("http://mysite.com/main-menu.html");
}
</script>
This works in some browsers, but not in Chrome. Is there a better way to get a form submit and javascript call to happen from the same button click ?
Instead of using
target='_blank'to open the new window you could just prevent the default submit action and usewindow.openinstead. Not sure, but that might solve your Chrome issue.