0
ExecuteOrDelayUntilScriptLoaded(yourFunction, 'sp.js');

        function yourFunction() 
        { 

      var options = { url: 'https://mywebsite.sharepoint.com/MyApp/Pages/Default.aspx', title: 'Policy', width: 900, height: 400,dialogReturnValueCallback: onPopUpCloseCallBack };
                               SP.UI.ModalDialog.showModalDialog(options);


         }

         function onPopUpCloseCallBack(result, returnValue) 
         {
             if(result== SP.UI.DialogResult.OK)
             {

                  SP.UI.Status.removeAllStatus(true);
                  var sId = SP.UI.Status.addStatus("you clicked ok");
                  SP.UI.Status.setStatusPriColor(sId, 'green');
             }
            else if(result== SP.UI.DialogResult.cancel)
             {
                 SP.UI.Status.removeAllStatus(true);
                 var sId = SP.UI.Status.addStatus("you clicked cancel");
                 SP.UI.Status.setStatusPriColor(sId, 'yellow');
             }
        }

I have used the above code to display a page named Default.aspx in a modal popup but unfortunately it gives me following error

enter image description here

Am I doing something wrong Or its not possible to display a page in modal popup in SharePoint Online?

The same code works perfectly on SharePoint 2013 on premise.

Can anyone help?

Thanks.

3 Answers 3

3

Use below script in CEWP

<a onclick="modalcall()" href="#">New Request</a>
<script type="text/javascript">function modalcall() { 
    SP.UI.ModalDialog.showModalDialog({ 
    url: "NewForm.aspx", 
    title: "New Form", 
    allowMaximize: true, 
    showClose: true, 
    dialogReturnValueCallback: refreshCallback
    }); 
}; 
function refreshCallback(dialogResult, returnValue) { 
SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);}</script>

the content cannot be displayed in a frame sharepoint

0

http://www.sharepointpals.com/post/The-Content-cannot-be-displayed-in-a-frame-Display-another-SharePoint-WebApplication-inside-an-iFrame-of-our-SharePoint-Site

@luckydeveloper I hope this will help you

0

You have two options, use a html page if it's possible, or add <WebPartPages:AllowFraming ID="AllowFraming" runat="server" /> to your aspx page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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