Here’s a little nugget I came across, on SharePoint 2010 and 2013 (including O365), and was exceptionally frustrated with. There’s a difference between IsDlg and isdlg. See it? Case sensitivity. Come to find out that means the world to SharePoint.
I was tasked to setup a basic Page Viewer web part to consume a page from another web. Simple enough. I threw the URL into the web part, including IsDlg=1, and blamo, I got my page. However, I couldn’t scroll the web part. The page I was using was longer than the web part, which would normally cause the page to scroll, but alas, not in this web part.
Enter the IsDlg parameter. Don’t know what IsDlg is? It’s a little query string parameter that SharePoint uses to hide elements on your page using CSS. Have you noticed that if you enable the dialog on a list, and the forms then appear in the dialog window, that the header is missing? The left nav too?
It’s the same page as if you didn’t use the dialog setting, Microsoft isn’t crazy enough to have two versions of a page that does the same thing. Instead when the IsDlg parameter is sent to the page as a parameter in the query string, it hides everything on the page with a CSS class of s4-notdlg.
Here’s what the URL may look like:
Note the IsDlg=1 at the end. I’m a big fan in questioning everything, so let’s try it out for ourselves.
Go to a display form of a list item, which is not in a dialog.
and add &IsDlg=1 (case sensitive) to the end of the URL, hit enter.
See how we lost the top header and left nav? Looks like the dialog up above, right? Pretty cool eh? So, as you may be thinking, “this is awesome, I can use this in the page viewer web part too”. You would be correct in your thinking! Here’s where things get a little fishy.
When you use IsDlg (again case sensitive), SharePoint does NOT scroll the window if the window requires it. Again, give it a whirl. Take your window you used above, and resize it so it’s nice and small, put the Close button below the bottom of the window.
See? The close button is below the window, but there’s no scroll bars. If you change the IsDlg to isdlg, then you get a happier page.
Whew, there’s our trusty little scroll bar, now I can press Close.
Let’s dig deeper: core.js
isdlg = (ajaxNavigate.get_search()).match(new RegExp("[?&]IsDlg=1"));
This is great for the dialog interface SharePoint is use to as they will size with the page. Now the user is scrolling the entire page and not just the page within the dialog. This is annoying for us if we want to use IsDlg feature elsewhere and we want to scroll just inside the web part. We have to use the isdlg option instead.
Oh yeah, I confirmed this occurs in Internet Explorer, FireFox and Chrome too ;)
‘Til next time, Happy SharePointing!
Question for you David, I am trying to use IsDlg=1 when displaying a document library which works perfect for the initial view, but when a folder inside that library is clicked I lose the hidden elements ( with the URL change). Do you know of a way to keep the elements hidden throughout all child folders?
Hmm i’m not sure. I haven’t looked at this for many years… Sorry I can’t be of more help!
For those seeking the same on Modern SharePoint Online pages (as I was) switch to using:
Genius! I just ran into this trying to show a SharePoint InfoOath form library, and forms, in an iframe or popup from within a custom web-based business system. I had “IsDlg=1”. :( Your solution fixed the scrollbar issue immediately. Thank you!
Awesome, thanks for sharing!
when adding isdlg=0 to a link, the majority of the tine when I open the link the following is added: “&IsDlg=1” which then stops the user from being able to scroll????
any reason why this is happening?
I’m not sure, I haven’t see it add it automatically. What SharePoint version are you on?
How can I resize a dialog box automatically based on content?
I changed the link and although I see a scrollbar, the scrollbar is not working.
What is the link exactly? Can you past the last part of it, like page.aspx?…
Actually passing isdlg with ANY value is doing the trick. As well as passing IsDlg with any value EXCEPT 1 will work.
?IsDlg=1 – no scrollbars
?IsDlg=0, ?IsDlg=whatever, ?isdlg=0, ?isdlg=1, ?isdlg=ilovesharepoint – scrollbars are shown
You can just add IsDlg=0 and it will do the same as isdlg=1.
Very insightful post. Is there a way to prohibit my-site profiles from opening in a dialog? Thanks!!!
Sorry, not sure I follow. Do you mean when a name is clicked? Or when the uses click on their name and go to my settings? What version of SharePoint?
thank you for sharing this :-)