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
 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

share|improve this question
What url do you use? – Anatoly Mironov Mar 5 '13 at 10:38
What is the value of the variable "url" ? – Magnus Hansson Mar 5 '13 at 10:41
Thanx @Anatoly Mironov. Sorry Its my mistake. I have passed url "siteUrl/_layouts/Page.aspx?ID=6"; – Viraj Gorajia Mar 5 '13 at 11:53
@Magnus Hansson I have changed url.. Any suggestion? – Viraj Gorajia Mar 5 '13 at 11:55
Just to be sure, can you navigate to siteUrl/_layouts/Page.aspx?ID=6 directly in the browser? On the other hand, is there any other page you can try to open in the modal? – Anatoly Mironov Mar 5 '13 at 13:57
up vote 1 down vote accepted

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.

share|improve this answer
Thnk you so much @Magnus Hasson. It's working for me... – Viraj Gorajia Mar 6 '13 at 5:54
Welcome .. sometimes it is the smallest things. I made that error once myself :) – Magnus Hansson Mar 6 '13 at 7:14
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);

Try this

share|improve this answer

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.


share|improve this answer
Hello @Stephen but how can i write this following anchor tag in my custom page?? – Viraj Gorajia Mar 5 '13 at 12:34
I made my page a webpart page and added it via the HTML source editor... – Stephen Mar 5 '13 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.

share|improve this answer

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.