I built a WebPart for SharePoint 2010, in this WebPart, when I click a button, it will popup a dialog which contains an image, I just call the sp.ui.modaldialog api direcyly.
ExecuteOrDelayUntilScriptLoaded(function(){SP.UI.ModalDialog.showModalDialog(options)}, “sp.ui.dialog.js”)
As SharePoint 2013 is released, I want to move this WebPart to SharePoint 2013, but I met a problem after the migration. When an user log in, the popup works well, but if current user is anonymous, it doesn't work.
I tried to debug it, and I found the variable "g_ExecuteOrWaitJobs" contains all the events to be executed as soon as js is loaded. My function is also in the waiting jobs queue, but the property "notified" is false, which explains why popup is not triggered.
So I checked the scripts in the page, the developer tool shows that all the "sp.*.js" are not registered to the page.
So I got the reason, as "sp.ui.dialog.js" is not registered, my function will never be notified. but in SharePoint 2010, "sp..js" are registered for anonymous user(and also in "SharePoint 2010" view in SharePoint 2013), why is it changed? If we see the page source, it will register the "sp..js", why is it not registered at last?
<script type="text/javascript">RegisterSod("sp.ui.dialog.js", "\u002f_layouts\u002f15\u002fsp.ui.dialog.debug.js?rev=2hnmqeYvKPxuEddYqrW\u00252F0A\u00253D\u00253D");
How to call the SP.UI.ModalDialog.showModalDialog function for anonymous user? Thanks in advance.