Move the ALERT('') popup message to the middle of the screen

AngelP83
Giga Guru

Hello,

Is it possible to move the alert(' HELLO WORLD') script to the middle of the page (middle vertically)?

At the moment, it is in the middle horizontally, but I was asked to also move it vertically.  According to: https://docs.servicenow.com/bundle/tokyo-application-development/page/script/general-scripting/refer...  That cannot be done.  I might need to create my own script?  

Thank you

 

Miguel33_0-1682519858470.png

 

1 ACCEPTED SOLUTION

@AngelP83 

As per Karan it also depends on browser.

But we never know which browser end user uses.

you can use UI page in that case and show the pop-up in the middle.

the link you shared is the one which you need to follow

sharing additional links as well

https://www.servicenowguru.com/system-ui/glidedialogwindow-quickforms/ 

https://www.servicenowelite.com/blog/2013/11/24/glidedialog-window-example 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@AngelP83 

not possible using the javascript alert() function.

it always shows on the top.

You can use GlideDialogWindow and show UI page with OK button and it will show in the middle.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks for the quick response Ankur!
Is this what I should be following? https://servicenowguru.com/system-ui/glidedialogwindow-advanced-popups-ui-pages/

Or would you have a different site that I can follow?

 

It seems a little complex for adding a popup, I don't know why my client is not happy with that alert.

Thank you again!

@AngelP83 

As per Karan it also depends on browser.

But we never know which browser end user uses.

you can use UI page in that case and show the pop-up in the middle.

the link you shared is the one which you need to follow

sharing additional links as well

https://www.servicenowguru.com/system-ui/glidedialogwindow-quickforms/ 

https://www.servicenowelite.com/blog/2013/11/24/glidedialog-window-example 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you Ankur,

So, just to confirm... even if I use the UI Page, it might still not be in the center?  it all depends on the browser?  or the UI page will definitely put it in the middle.

 

Thank you