3

I want to open a sharepoint page to be opened in a model popup with only close option. I should be able to adjust the size of the popup as well . And onclick of close ,the browser should be closed . I would like to do this using Content Editor WP and want to see the page with master page data and navigation.

5

You can add script in Content Editor WP, to open the page as dialog,

Load first SP.js and add following script

ExecuteOrDelayUntilScriptLoaded(function () {
     var dialogurl = "your url";
            var options = {
            url: dialogurl,
            width: 700,
            height: 700,
    dialogReturnValueCallback: OnDialogClose
            };
            SP.UI.ModalDialog.showModalDialog(options);}, "sp.js");

When the user clicks the submit form, you would run the following line of JS:

 function OnDialogClose(dialogResult, returnValue)  {
     if (result == SP.UI.DialogResult.OK) {
         // to close
     SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK);
     } else {
        // logic 
     }

other options to set for dialog follow the below link http://msdn.microsoft.com/en-us/library/office/ff410058(v=office.14).aspx

  • As the user wants to close the Browser window, the window can only be closed if it was opened by JavaScript.. In order to achieve that window.open('', '_self', ''); window.close(); this should work.. – Arsalan Adam Khatri Apr 15 '14 at 6:11
  • Cannot see the master page contents of the page in the popup . – Nikhil J Apr 15 '14 at 17:41
  • 1
    Can you elaborate page type? its a content page or oob list page? – Anuja Apr 16 '14 at 4:08
  • Similar issue : sharepoint.stackexchange.com/questions/94181/… – Nikhil J Apr 16 '14 at 16:40
  • its a content page . – Nikhil J Apr 16 '14 at 16:41

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.