how to remove/hide prevent this page from creating additional dialogs in alerts message

KB18
Tera Guru
Tera Guru

Hello All,

Kindly help to hide/remove "prevent this page from creating additional dialogs" in alert message using in ui action.

Please hit the thumb Icon and mark as correct in case I help you with your query!!!
- Kailas
6 REPLIES 6

Steve McCarty
Mega Guru

I'm pretty sure that message comes from the browser that you are using, not Service-Now.   You will have to change the settings in your browser to stop it from displaying that message.



-Steve


Agreed.   This is a known feature within the Google Chorme browser.   You can't turn it off either (according to http://stackoverflow.com/questions/11729835/how-to-disable-prevent-this-page-from-creating-additiona...)


Hi Stephen,



This is not for the specific user and i want it through code so that nobody can see that.



Regards


Kailas Bandiwar


Please hit the thumb Icon and mark as correct in case I help you with your query!!!
- Kailas

You can't change it through code.   It is designed to keep sites from getting you stuck on their page by constantly opening new alerts.   If there was a way to turn it off via code, then it would be a useless feature.



That being said, you can create a UI page that just displays a message, then open that UI page with a GlideDialogWindow.   Displaying a Custom Dialog - ServiceNow Wiki   has a good description of how that works.   There is a built in UI page that just displays a message.   In a client script or UI action you would use the following code instead of an alert statement:



var dialog = new GlideDialogWindow('glide_alert_standard');


dialog.setPreference('warning','true');


dialog.setPreference('title','Whatever you want the message to say!');


dialog.setTitle('Message for you');


dialog.render();



It's a little more code than just putting in an alert statement, but the user can't block this by checking the "prevent this page from whatever" box.   The best part of this approach is that you can completely customize the alert window to include more information, pictures, tables, or whatever other elements you want.



-Steve