I have added additionalpagehead in SharePoint which will run a javascript functions to show some texts.

It is working fine in all the SharePoint pages but it is working in SharePoint popup window also.

How can I restrict it from popup windows?


You will need to check if IsDlg query string parameter is not defined. For modal dialogs it is set to "1".

JS code to achieve this client-side:

// GetUrlKeyValue is an existant SharePoint function from init.js
var isDlg = GetUrlKeyValue("IsDlg");

if (!isDlg)
   // show your text here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.