Tenho um código JS para abrir um popup com window.open() e preciso fechá-lo depois de 1 segundo. Quando mando a url "https://api.whatsapp.com/" ele faz o que preciso, mas se enviar o link com parâmetros: "https://api.whatsapp.com/send?phone=5596991100451" a tela não fecha.
Código HTML:
<div
class="whats-link"
data-href="https://api.whatsapp.com/send?phone=55<?=$cliente['telefone1'];?>"
onclick="openNewWindow(this);"
style="cursor:pointer;">
Whatsapp 1
<i class="icon-wts fa fa-whatsapp" aria-hidden="true"></i>
</div>
Código JS:
function openNewWindow(el) {
let url = el.getAttribute('data-href')
let openedWindow = window.open(url, 'newwindow', 'height=200,width=200')
setTimeout(() => {
openedWindow.close()
}, 1000);
}