Skip to main content

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

 

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:

function onLoad() {
//Type appropriate comment here, and begin script below
var sMsg = 'test the display message';
if (typeof spModal != 'undefined') {

// Portal

spModal.alert(sMsg);

} else {

// Desktop UI
var gm = new GlideModal();
gm.setTitle("Warning");
gm.renderWithContent(sMsg);

}

}

Comments