Problems running window.onbeforeunload in Angular

Asked

Viewed 17 times

0

I need to open an external site and when the user closes this window I will have to capture an element.

The problem is that it is not going through the log inside onbeforeunload...

My code in the stackblitz

  abrir() {
    const w = window.open(
      `https://servicos.receita.fazenda.gov.br/Servicos/CPF/ConsultaSituacao/ConsultaPublica.asp?cpf=004.000.343-51&nascimento=14/02/1986`,
      "",
      "width=800,height=4600"
    );

    w.onbeforeunload = function() {
      console.log(`èfwefw`)
     
    };
  }
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.