Accept confirm dialog

Post Reply
envoy
Posts: 1
Joined: 26.06.14 22:22:30

Accept confirm dialog

Post by envoy » 26.06.14 22:39:54

How to accept an confirm box using Tampermonkey? I want to automatically click OK.

When my script automatically pushes the button

var x = getElementById("btn"); // button

x.click();

then page of the site shows a browser dialogue with choice OK and Cansel // javascript confirm

Image

here what code i need add for auto push OK?


omg i сan not find the answer for 3 days, any one help please.

User avatar
derjanb
Site Admin
Posts: 2383
Joined: 20.01.06 02:16:15
Contact:

Re: Accept confirm dialog

Post by derjanb » 28.06.14 22:52:21

Something like this should help:

Code: Select all

(function() {
  var confirm = window.confirm;
  unsafeWindow.confirm = function(question) {
      if (question == "Do you want to auto confirm this?") {
        return true;
      } else {
        return confirm(question);
      }
  };
})()
ImageIf you like what I'm doing, please consider a donation here. Image

thienha1
Posts: 3
Joined: 13.01.18 10:33:04

Re: Accept confirm dialog

Post by thienha1 » 19.01.18 10:30:52

Not working .........
Last edited by thienha1 on 19.01.18 10:32:00, edited 1 time in total.

thienha1
Posts: 3
Joined: 13.01.18 10:33:04

Re: Accept confirm dialog

Post by thienha1 » 19.01.18 10:31:32

derjanb wrote:
28.06.14 22:52:21
Something like this should help:

Code: Select all

(function() {
  var confirm = window.confirm;
  unsafeWindow.confirm = function(question) {
      if (question == "Do you want to auto confirm this?") {
        return true;
      } else {
        return confirm(question);
      }
  };
})()
Your script dont working anymore, pls update your script!!

Post Reply