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 ?
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 ?
Share Improve this question asked Mar 2, 2016 at 8:06 xRobotxRobot 26.6k72 gold badges192 silver badges317 bronze badges 2- 1 See this answer: stackoverflow./questions/20672490/… – Anoxy Commented Mar 2, 2016 at 8:12
- As far as I know, this is not possible to do in any clean way as it's a browser feature, and if the browser doesn't let you know then you can't know. – RRR Commented Mar 2, 2016 at 8:14
1 Answer
Reset to default 11try 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.