Click OK button of window.confirm

1

Good afternoon, when I click on a button it opens a window.confirm obviously it has an OK and CANCEL, I would like to know if there is a way I can click this OK button once it opens with javascript?

HMTL

<a href="/excluir/recado/5735526/b3dd743495e9e826c7703b7f3d26a545" onclick="if(!confirm('Tem certeza que deseja excluir esse recado?')) return false;" class="btn-orkut">excluir<*a>

Javascript:

document.getElementsByTagName("a")[0].click();

The javascript works fine, but as default opens the confirm window, and in that I have to stay clicking OK I would like to know if there is this possibility of javascript being clicked OK. grateful

    
asked by anonymous 15.05.2016 / 20:28

1 answer

1
  

I would like to know if there is a way for me to click this OK button as soon as it opens

Does not exist.

Native browser windows are very limited in terms of interaction. This is for security reasons, to take care of the user. If this were possible there would be no security for the user to respond to whatever they want in this confirmation request.

    
15.05.2016 / 20:30