In chrome there is a way to disable alerts by selecting "prevent this page from creating additional dialogs".
Is there a way to check via javascript if the user has disabled the alerts ?
try this demo
function checkIfAlertDisabled()
{
var startTime = new Date().getTime();
alert("asdasdasdasdasdasd");
var endTime = new Date().getTime();
return ( endTime - startTime ) < 50;
}
console.log( checkIfAlertDisabled() );
I think 50 is a safe number since usually it won't take more than 1 millisecond to process a non-working alert. Also, there is very unlikely that someone will be able to process a working-alert within 50 milliseconds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With