I am calling a modal dialog. The dialog should perform an action in the code behind, then immediately close and show a notification in the parent window. I am using the following bit of code:
SP.UI.ModalDialog.showModalDialog({
url:'{SiteUrl}/_layouts/myproject/UserActions/myaction.aspx',
dialogReturnValueCallback:function(status,result){
SP.UI.Notify.addNotification(result, false);
}
});
The closing of the page is done by calling the following function at the end of the Page_Load:
private void Close(int status, string message)
{
Page.Response.Write(string.Format("<script type=\"text/javascript\">window.parent.SP.UI.ModalDialog.commonModalDialogClose({0}, '{1}');</script>",status,message));
Page.Response.Flush();
Page.Response.End();
}
This works fine on my own machine, but on some other environments, this does nothing. The modal dialog remains open. If I check the contents of the frame I see that the bit of javascript is present in the head of the page. So it seems my .aspx page is fine, but the javascript is missing something?