I have some code that uses a form.submit() to open up another window when you click something on my page. It works fine in IE 6-8, Firefox and Chrome, and Safari on Mac. But in Safari on Windows XP, after you click that something, none of the other links that do form.submit() work. Even the same something doesn't do it. Here's some of the callback code for that button:
accessEmployeeViewClicked = function() {
var form=document.Form<xsl:value-of select="//PAGE/@NAME" />;
form.action = 'ServletName';
form.target = "otherTarget";
form.submit();
};
The function is accessed by the following code:
<a href="#" onclick="accessEmployeeViewClicked();return false;">Access employee's view >></a>
I put a breakpoint in the Safari built-in debugger, and the second time you click it, it definitely gets into the accessEmployeeViewClicked()
function, but the form.submit();
does nothing. As per the suggestion in the comments, I changed the form.target to "_blank" but that had no effect.
I've looked at these similar questions:
Firefox handles xxx.submit(), Safari doesn't ... what can be done?
document.form.submit(); won't submit in safari
and tried the suggestions, and they don't help.
It appears Apple must be aware of the problem, since it was logged in 2009 and supposedly went into their "radar" bug tracking system, but they must not care: https://bugs.webkit.org/show_bug.cgi?id=28633
I implemented the work-around from that bug report, and it worked:
form.action = 'ServletName';
// Work around for Safari bug suggested in https://bugs.webkit.org/show_bug.cgi?id=28633
if ($.browser.safari)
{
form.action += '?t=' + new Date().getTime();
}
form.target = "otherTarget";
form.submit();
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