Safari 5.1.4 showModalDialog returning undefined

We're using the code from this answer to Safari 5.1 prompt() function and cancel as a replacement for prompt in Safari 5.1, to work around the bug in that browser where the "Cancel" button returns the empty string rather than null .

Now we're suddenly having trouble with showModalDialog often (but not always) returning undefined instead of the value assigned to the popup's returnValue property. Note this is not due to cross-domain issues and is not due to form submission or other page reloads in the popup. While this may be unrelated, the problem does not occur on a machine still running Snow Leopard rather than Lion. The problem also does not occur in Firefox, Chromium, or IE8. A test page is available at http://www.thesaabsite.com/js/safari-5.1-bugfix-test.html.

Is something wrong with what we're doing, or is it a bug in Safari?


I had a similar problem with Chrome. Although the cause is probably not the same, the workaround given in this thread may help you, at least until you find the real solution.

链接地址: http://www.djcxy.com/p/63116.html

上一篇: Safari Mac OSX Backspace问题

下一篇: Safari 5.1.4 showModalDialog返回undefined