简体   繁体   中英

Chrome multiple window.open with mailto?

I've a website with a table of contacts and a button. When the button gets clicked i want to open a mail client for each selected contact. But at least in the chrome webbrowser only the first window.open() is firing. The problem is already known that chrome does support only one window.open() with one user action (button click).

But isn't there a workaround?

function openMail(){
    let selected = $("#table").bootstrapTable("getSelections");
    for (let row of selected) {
         window.open(`mailto:${row.email}?subject=${row.bsubject}&body=${row.body}`, '_self');
    }
}

the second parameter of window.open is the name of window. You have to assign a unique name (eg the number of row) instead of _self

    var roworder=0;
        for (let row of selected) {
           roworder++;
           window.open(`mailto:${row.email}?subject=${row.bsubject}&body=${row.body}`,
 'prefix-'+roworder);
    }

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM