Consider the following code:

var options = {
    title: 'Create a new Post'
    autoSize: true,
    url: url


The code is executed from a ECB custom action and from a web part. It works fine in IE, however when i call it from the webpart in Google Chrome it gives the following error:

Uncaught TypeError: Object # has no method 'showModalDialog'

The strange thing is that when i call the exact same code (it's part of my library) from the ECB custom action it now works in Google Chrome!

I've tried calling it with

  • ExecuteOrDelayUntilScriptLoaded
  • _spBodyOnLoadFunctionNames.push("funcname")
  • LoadSodByKey("sp.ui.dialog.js", null);

Any ideas or help? It's driving me crazy!

  • How are you calling it from your webpart? On page load? – Chloraphil Jul 5 '13 at 16:03
  • no, button click event. i attach to it using jquery... i understand the error, the dialog module has not been fully loaded, but i dont understand why its happening as it works with IE perfectly... – int32 Jul 5 '13 at 18:51
  • Any other errors in the console? Is the web part on the same page as the custom action? – Chloraphil Jul 5 '13 at 19:28
  • This is a shot in the dark, but I implemented the following to fix the issue with the scrollbar not appearing in Chrome. Perhaps it's related: withinsharepoint.com/archives/256 – Chloraphil Jul 5 '13 at 19:31
  • no, no other errors. no they are not on the same page. thanks for the link, will try it out and let you know! – int32 Jul 5 '13 at 19:41

This is a Chrome issue with it's caching model.

Please make sure you call

LoadSodByKey("SP.UI.Dialog.js", null); 

To ensure the file is loaded.

  • thanks, i already tried that though and it did not work. see my initial post – int32 Dec 2 '13 at 14:03
  • This is the correct fix for the issue, where did you run this code? If it isn't working then there is something else wrong perhaps to many async calls? – Hugh Wood Dec 2 '13 at 14:06
  • from within a Web Part (in an external js file, though).. i do agree, but i never got it to work like this in Chrome. I think thats a specific issue with Chrome, because it works with every other browser just fine, so i will mark your answer as correct anyway. – int32 Dec 4 '13 at 14:13
  • perhaps the key was wrong? You can jump into the console and take a look at the SP.SOD dictionary object – Hugh Wood Dec 4 '13 at 14:24

This specified error that is encountered in Chrome browser, could be eliminated by using SP.SOD.execute(key, functionName, args) Method.

Replace the line


with the

SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.