See: http://www.digitalmars.com/contact.html The website uses the following code to generate a mailto: link equivalent (and to prevent spam): <SCRIPT LANGUAGE="javascript"> <!-- var Domain = "digitalmars.c"; var Mailme = "mai" + "lto:w" + "gmars7@" + Domain + "om"; document.write("<FORM>"); document.write("<INPUT TYPE=\"submit\" VALUE=\"Send email to Digital Mars\" "); document.write("onClick=\"parent.location=Mailme\"> "); document.write("</FORM>"); // --> </SCRIPT> This code works fine in Firefox 2.0 (and other browsers), but fails in latest Tiger Safari, as well as nightly r17960. This is a pretty important website (Digital Mars is the creator of the D programming language, a really good language that hasn't yet caught on: http://www.digitalmars.com/d/ ).
What happens is that your form gets posted. You should remove the form tags at all or set the submit to return false, e.g. <SCRIPT LANGUAGE="javascript"> var Domain = "digitalmars.c"; var Mailme = "mail"+"to:w" + "gmars7@" + Domain + "om"; var html = "<form onsubmit='return false;'><input type='submit' value='send email' onclick='javascript:document.location.href=\""+Mailme+"\"'></form>"; document.write(html); </SCRIPT> Also, you'll not get a valid code out of this with just plain-empty form tags which is not the case if you leave them out.
But it works in other browsers. Which makes Safari the incompatible one.
I don't agree incompatibility. The latest Opera 9.24 behaves the very same way. And these are the first browsers to pass Acid2. In my humble opinion this is the case of valid coding. It is programmatically proper to be precise and strict in respect to the open standards.
By the W3C HTML 4.01 Specification: - submit buttons: When activated, a submit button submits a form. A form may contain more than one submit button.
Created attachment 16782 [details] test case (with javascript: URL)
We certainly want to be compatible with IE and Firefox, and I actually don't think that this behavior is non-standard. Onclick fires before submitting the form, and javascript/mailto URLs can be loaded synchronously. After that, the form is submitted. See also: bug 13011.