I have tried creating a modal dialog in a SharePoint Hosted APP using this script but I am getting an empty page in the resulting modal dialog.

<script type="text/javascript">
    var ShowDialog = function () {
        var options = {
            url: '/SitePages/Test.aspx',
            title: 'Modal',
            width: 640,
            height: 400,
            dialogReturnValueCallback: function(dialogResult, returnValue) {

     //SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', ShowDialog);
    ExecuteOrDelayUntilScriptLoaded(ShowDialog, "sp.ui.dialog.js","SP.UI.ModalDialog.showModalDialog");

What is wrong with my code?

  • I think you must pass in the full URL to the page you want to show – Robert Lindgren May 17 '16 at 19:41
  • Yes I tried already... – software dev May 18 '16 at 3:30
  • Check your F12 browser Dev tools - there should be a error showing you what went wrong. Also check the IFrame created for the modal. – Mx. May 18 '16 at 9:00

Your Answer

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

Browse other questions tagged or ask your own question.