SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a sharepoint hosted app page.

I have a link in it. Clicking on it it should open a modal pop up whose url is the home page of the sharepoint site.

I am able to open a modal pop up window but it is not showing any content of any external site. I tried the url as "", still the modal pop up window was blank. I have used the code :

<script type="text/javascript" >
    function openDialog(strPageURL) 
        var options = {
            url: strPageURL,
            showMaximized: true,
            width: 800,
            height: 500,
            title: "Title of Dialog"
        SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);

 <a onclick='javascript:openDialog("");javascript:return false;' href="#" target=_self> Click to Open</a>

Any idea why the content of the modal is null or displaying null?

share|improve this question
maybe the problem is because you trying to show a content that come through out of your domain – Salvatore Di Fazio May 23 '13 at 8:57
Thanks Salvatore Di Fazio Is there any work around to show content out of the domain? – Sushri May 23 '13 at 9:37

This is probably due to Cross Site scripting. This is not allowed, but there are som workarounds.

This MSDN thread has some suggestions


<a href="JavaScript:var options=SP.UI.$create_DialogOptions();
 options.width = 800;
 options.height = 600;
 options.title = 'A working and simple popup';
 <img src="http://webapp1/Style Library/Images/icon.png" border="0" alt="A working and simple popup" />

that maybee can work.

But basically this is a security feature for stopping "click jacking" and other hacks with javascript.

Here is an Microsoft code demo outlining the steps to retreive data from a webservice witch is not in the same domain as the executing javascript:

Perhaps it can get you in the right direction

share|improve this answer
Thanks Robert for your help. I tried you code but it is also not working. Same blank modal pop up is opening. Any other workaround? – Sushri May 23 '13 at 9:42
Added a link to a code example from msdn, but basically search the web for "sharepoint app cross site" and look out for some code that suits your scenario. – Robert Lindgren May 23 '13 at 10:34
Thanks Robert I will try to find something on web. – Sushri May 23 '13 at 11:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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