javascript - simple mailto function that composing an email from html file -
i need create simple mailto function when click on html file brings default email application composed mail "ready-to-go." figured click event on mailto id sufficient, not firing. should do? fyi, not want user click on hyperlink. plan on removing it.
<script type="text/javascript"> $(document).ready(function(){ $("#mymailto").click(); }); // document.ready </script>
<!doctype html> <html> <head> <title>your title here</title> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta http-equiv='cache-control' content='no-cache'> <meta http-equiv='expires' content='0'> <meta http-equiv='pragma' content='no-cache'> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> </head> <body> <a href="mailto:testemail@gmail.com" id="mymailto" >email</a> </body> </html>
just use document.location.href="mailto:testemail@gmail.com";
.
Comments
Post a Comment