javascript - Simultaneously open mailto and submit form -


at management's request, need open user's email client , submit form on button click. had

window.location = "mailto:email@example.com"; 

as callback click event submit input, doesn't work. seems form submits quickly.

using window.open work, creates blank window undesirable.

i had idea prevent , delay form submission in

window.location = "mailto:personalcounselor@gleim.com"; settimeout(function () {      $(this).closest('form').trigger('submit'); }.bind(this), 1000);  e.preventdefault(); 

this works, seems sketchy me.

is there way submit form , open mailto link @ same time?

i don't know if work, sure bit of tweaking should work , have desired result after (it long fit in comment, if not work gladly delete it!);

$("form").on("submit", function() {      window.onbeforeunload = function() {          window.location = "mailto:email@example.com";      }; }); 

simply put when form submitted, set onbeforeunload event change location mailto. think doing way make mailto open if form submitted rather when user navigates away.

i don't know if work, or how hacky is, thought throw in 2 cents!

update

on form submit, mailto javascript form values

this seem work , verified others.

$("input[type=submit]").click(function(){      window.location.href = "mailto:email@example.com"; }); 

Comments

Post a Comment

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -