Google chrome not displaying alert() popups for one site

后端 未结 8 795
北海茫月
北海茫月 2021-02-05 03:38

I was working on a javascript loop that alerted each key value as the loop progressed.

To speed things along, I checked the box \"Prevent this page from creating additio

8条回答
  •  悲哀的现实
    2021-02-05 04:21

    If you want to detect if these are being blocked. You will have to do your own thing with the message you will be dispalying but override the native alert/confirm.

    window.nativeAlert = window.alert;
    window.alert = function (message) {
    var timeBefore = new Date();
    var confirmBool = nativeAlert(message);
    var timeAfter = new Date();
    if ((timeAfter - timeBefore) < 350) {
        MySpecialDialog("You have alerts turned off, turn them back on or die!!!");
      }
    }
    
    window.nativeConfirm = window.confirm;
    window.confirm = function (message) {
    var timeBefore = new Date();
    var confirmBool = nativeConfirm(message);
    var timeAfter = new Date();
    if ((timeAfter - timeBefore) < 350) {
        MySpecialDialog("You have alerts turned off, turn them back on or die!!!");
    }
     return confirmBool;
    }
    

    Obviously I have set the time to 3.5 milliseconds. But after some testing we were only able to click or close the dialogs in about 5 milliseconds plus

提交回复
热议问题