Click here to Skip to main content
15,115,119 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to disable "prevent this page from creating additional dialogs" alert using javascript.
Posted
Comments
Nicholas Marty 14-Nov-13 6:37am
   
I might be wrong but I guess this is nothing you can influence yourself as this a functionality of the browser. If you don't want this message just stop displaying multiple alert messages ;)
balajit12 14-Nov-13 6:44am
   
Hi,

Thanks for your answer.
I have one more question, how the end user knows the mandatory fields.....If alert is not displayed....:)

Nicholas Marty 14-Nov-13 6:51am
   
Just show him an error message on the page. (e.g. render a new html on the server side or modify the html document on the client side with some javascript). You can for example show an asterisk (*) beside the field or color it in red where an input value is missing thus making it easier for the user to spot the fields he has missed.
♥…ЯҠ…♥ 14-Nov-13 6:56am
   
if there are 50 fields in a page, if user misses 2nd required field then you will alert him with 48 alert box that user missed remaining fields? don't you think this is awkward.....?
balajit12 14-Nov-13 7:08am
   
once user prevent the alert box in 2nd field then remaining 48 fields popup message won't be displayed.
♥…ЯҠ…♥ 14-Nov-13 7:16am
   
then it will be meaning less right? if you done like this then user wont come to your site again, user will be annoyed with 48 alertbox, so its best to put * next to the missing field and ask user to fill it out.

1 solution

Hi Balaji,

This is a browser feature and is intended to protect the user, If you could turn it off, all those sites spamming users with dialogs would have a way to stop it.

So in short, no.

Okay -
If you are not satisfied with the above answer and you want to go ahead and disable, then also you have an option - this is CodeProject buddy ;-)

Steps to recreate:
JavaScript
alert('Alert1');
alert('Alert2');

Alert2 is displayed with that prevent this page from creating additional dialogs annoying checkbox
Now change the above code into
JavaScript
alert('Alert1');
setTimeout(function(){
        alert('Alert2');
    }, 1000);

Now you wont see that annoying message and its checkbox in the second consecutive alert

Note: Dont reduce the timeout value, if its with in 1sec then browser will automatically add that warning to the alert.

Hope this helps you a bit.

Regards,
RK
   
v2
Comments
♥…ЯҠ…♥ 14-Nov-13 7:18am
   
Come on, I don't know why this question is down voted, since it gives both negative as well as positive solution to the problem.
   
Of course, a 5.
But of course, all these alerts is lame in first place...
—SA
♥…ЯҠ…♥ 14-Nov-13 8:56am
   
;-) Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900