I need to open an external web page, say, http://google.com in a modal dialog. So if I were to do


I get a modal window, however, it adds the IsDlg=1 query string parameter. In fact, Google pukes at the parameter that is appended.


What you could do is pop up an application page in a modal dialog box (using the 2010 dialog framework) that contains an iframe to your desired location. You could pass in the url the iframe should show in the querystring (make sure you encode it first, and decode it in the application page).

Beware that in 2010 you'll have the ribbon as well, so what I've done to circumvent this is follow this blog post to include another querystring param when calling your application page to hide the ribbon.

  • So you are suggesting that I pop up a modal of an application page. Then somehow change the URL that is being displayed? This way, the IsDlg=1 would no longer show up? p.s. That's my colleague's blog post :) – Tim Gabrhel Jun 3 '11 at 13:37
  • 1
    Nah I'm suggesting you pop up the application page, it'll append IsDlg, but you have an iframe in your app page which goes to where you want. Pass in the URL for the iframe in the querystring for the application page. Your colleague's a smart dude, that code helped me just last week :) – James Love Jun 3 '11 at 14:46
  • Gotcha. That's a disgusting solution but it appears to be all you can do. – Tim Gabrhel Jun 3 '11 at 15:21
  • Yeah, it is. Unfortunately the Modal Dialog framework will always append IsDlg to all URLs, as it was originally intended for use only with SharePoint Pages. – James Love Jun 3 '11 at 19:11
  • @JamesLove: Is it possible to use the html option of the showModalDialog function to pass in the iframe HTML with the URL already embedded into it? – Stu Pegg Oct 6 '11 at 7:45

Following on from James's answer, the html option of showModalDialog allows you to directly send html to be rendered in the dialog.

Unfortunately it accepts an HTML DOM object rather than an HTML string, so we would have to do the following:

<script language="javascript">
    function popUp() {
        var frame = document.createElement('iframe');
        frame.setAttribute('src', 'http://tsstsst.com');
        frame.setAttribute('width', '99%');
        frame.setAttribute('height', '98%');

        var options = {
            title: 'TssTssT',
            width: 950,
            height: 600,
            html: frame

<button OnClick="popUp();return false;">View Stu's blog!</button>

No application page required.

  • Thanks for the answer Stuart! That's a pretty neat solution and it should come in handy for me down the road. – Tim Gabrhel Oct 11 '11 at 13:15
  • 1
    This solution doesn't work and produces a security violation error: This content cannot be displayed in a frame To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame. – iOnline247 Nov 9 '11 at 15:44
  • @iOnline247: The code is fine, but the choice of website has since become problematic. Google is now explicitly forbidding this kind of usage, so I've updated it with my own iframe-friendly blog. :) – Stu Pegg Nov 9 '11 at 16:03
  • 1
    Thanks for the clarification. This works as expected. :) – iOnline247 Nov 10 '11 at 15:22

You can simply try to use something like javascript:OpenPopUpPage('http://google.com') in a link. Please note that this code is case-sensitive.

  • I didn't know that existed..However, that seems to append 'IsDlg=1' to the URL still. If you do "javascript:OpenPopUpPage('google.com',600,600);", Google throws up at the IsDlg=1 param. – Tim Gabrhel Mar 9 '11 at 19:49

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.