logo

NJP

Check if in Service Portal or Classic UI, and display message (catalog client script)

Import · Aug 25, 2020 · article

if (typeof spModal != 'undefined') {

// Portal

spModal.alert(sAlertMessage);

}

else {

// Desktop UI

var gm = new GlideModal();

gm.setTitle("Warning");

gm.renderWithContent(sAlertMessage);

}

see this catalog client script example:

//Type appropriate comment here, and begin script below

var sMsg = 'test the display message';

if (typeof spModal != 'undefined') {

var gm = new GlideModal();

gm.renderWithContent(sMsg);

View original source

http://www.cloudminus89.com/2020/08/check-if-in-service-portal-or-classic.html