Monthly Archives: November 2013

“Unable to get property ‘defaultDialogWidth’ of undefined or null reference” on SharePoint Modal Popup

Error message “Unable to get property ‘defaultDialogWidth’ of undefined or null reference ” was thrown when trying to load modal popup on a page where very less of CSOM related script loaded.  In case you haven’t set width or height it is suppose to pick the default value for height and width.  It happens to be all the default values used by most JSOM are loaded from a resource file. 

To be precised, the js library that has the method to load the modal popup  “SP.UI.Dialog.js” has a dependency to the “SP.Res” namespace from where it will pick all the defaults from. 

                                       LoadSodByKey(“sp.res.resx”, function(){
                                          LoadSodByKey(“dialogUI”, function () {

                                            SP.UI.ModalDialog.showModalDialog({url : ‘/sites/abc.aspx’, title: ‘My Page’});         

Simple but may not be the perfect solution for this it forcefully loading the sp.res.resx resource file content with “LoadSodByKey”.