Invoke / click a mailto link with JQuery / JavaScript

Justin picture Justin · Oct 6, 2010 · Viewed 89.8k times · Source

I'd like to invoke a mailto link from JavaScript - that is I'd like a method that allows me to open the email client on the users PC, exactly as if they had clicked on a normal mailto link.

How can I do this?

Answer

Nick Craver picture Nick Craver · Oct 6, 2010

You can use window.location.href here, like this:

window.location.href = "mailto:[email protected]";