Is it possible to launch a modal that doesn't have the IsDlg property?
-
16-10-2019 - |
Question
I need to open an external web page, say, http://google.com in a modal dialog. So if I were to do
SP.UI.ModalDialog.showModalDialog(options);
I get a modal window, however, it adds the IsDlg=1 query string parameter. In fact, Google pukes at the parameter that is appended.
Solution
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.
OTHER TIPS
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
};
SP.UI.ModalDialog.showModalDialog(options);
}
</script>
<button OnClick="popUp();return false;">View Stu's blog!</button>
No application page required.
You can simply try to use something like javascript:OpenPopUpPage('http://google.com')
in a link. Please note that this code is case-sensitive.