Forum Discussion
null null
Jun 29, 2017Iron Contributor
SP.UI.ModalDialog does not work for published page
Hi, I was trying to write some js code for modal window using
function OpenDialog(url) {
var options = SP.UI.$create_DialogOptions();
options.url = url;
options.width = 769;
options.height = 500;
SP.UI.ModalDialog.showModalDialog(options);
}However, the page works fine in edit mode but when i publish the code does not seem to work.
Could you please let me know, how get around it.
Thanks
2 Replies
- Shawn XiongBrass Contributor
use SP.SOD.loadMultiple to ensure 'sp.ui.dialog.js' is loaded before using modal dialog.
- Deleted
If I recall, when you're in edit mode, additional scripts are loaded into the page that may not be present in presentation mode. Can you confirm SP.js and SP.UI.Dialog.js are loading on the page when you're out of edit mode?