var options = 
        url: "http://siteUrl/_layouts/Page.aspx?ID=6",
            width: 800,
            height: 600,
        title: 'Attach File',


I have tried this javascript code. But it gives me error. Error in url of modal popup .It will redirect to this following url: res://ieframe.dll/http_404.htm#SiteURL?IsDlg=1


4 Answers 4


After looking closely on your code I see that you are having one extra "," after the title. That may case a problem for you. It should be defined like this:

var options = {
title: "My Dialog Title",
width: 400,
height: 600,
url: "/_layouts/DialogPage.aspx" };

No "," after the last parameter.

  • Thnk you so much @Magnus Hasson. It's working for me... Commented Mar 6, 2013 at 5:54
  • Welcome .. sometimes it is the smallest things. I made that error once myself :) Commented Mar 6, 2013 at 7:14
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);

Try this


Can i suggest the following? This is taken from a SP2010 solutions i developed but I'm sure it will work just the same...

<a id="idHomePageNewItem" onclick="javascript:NewItem2(event,&quot;http://siteUrl/_layouts/Page.aspx?ID=6&amp;RootFolder=&quot;);javascript:return false;" href="/_layouts/Page.aspx?ID=6&amp;RootFolder=" target="_self" style="width: 212px; height: 50px;">Your link text here</a>

Hope this helps.


  • Hello @Stephen but how can i write this following anchor tag in my custom page?? Commented Mar 5, 2013 at 12:34
  • I made my page a webpart page and added it via the HTML source editor...
    – Stephen
    Commented Mar 5, 2013 at 13:54

I have exactly the same system's behavior when page didn't exist with such URL (i thought it was, but actually it wasn't - usually, the simplest mistakes is harder to find). I always start checking URL first now - hopefully, it helps someone.

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.