is there anyway through which I can open more than one email client, (on a single click) in java script, I know how to use mailto but don't know how to open multiple clients this code opens the client on each reload.
window.location.href = "mailto:user@example.com?subject=Subject&body=message%20goes%20here";
Any help in this regard Thanks
If you want it to load the mail client on a click rather than every time the page refreshes, you want it attached to a click event, something like this :
<button class="button">Open Email</button>
Using jQuery :
$(document).ready(function(){
$('.button').on('click',function(){
window.location.href = "mailto:user@example.com?subject=Subject&body=message%20goes%20here";
});
});
Update
If you want it to load multiple instances of the client, just duplicate the window.location.href
:
$(document).ready(function(){
$('.button').on('click',function(){
window.location.href = "mailto:user@example.com?subject=Subject&body=message%20goes%20here";
window.location.href = "mailto:user@example.com?subject=Subject2&body=message%20goes%20here";
});
});
It is not possible to launch external applications from JavaScript in a Browser. mailto only launches the MUA which is configured as the default in the system-settings.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.