How can I close a Sharepoint Dialog which displays an APX page hosted from a different machine? RRS feed

  • Question

  • Hi,

    I have a Sharepoint Site that has embedded Javascript in page. This allows me to have a "Tech Support Link" next to "Share" and "Follow". This Javascript essentially opens a dialog with the url of another site (tech support page which accesses 3rd party Web Services). I want to be able to close the dialog after the following the alert that your "Your Ticket has been logged Successfully!".

    if (statusFlag == "Success")
                    this.ClientScript.RegisterStartupScript(this.GetType(), "ShowMessage", "alert('Your Ticket has been logged Successfully!'); document.close();", true);
                    this.ClientScript.RegisterStartupScript(this.GetType(), "ShowMessage", "alert('An error has occurred. Please call Ex:1219\n\nMessage: " + statusMessage + "'); ", true);

    The highlighted text is where I need to close the dialog. Problem is page is a standard aspx page, it doesn't contain sharepoint .js files etc.

    document.close() will not work and I have tried: window.reload(); window.history.back(); window.location.href=window.location.href; nothing will work.

    Does anyone have a workaround? 



    Wednesday, August 28, 2013 3:39 PM


All replies

  • Hi,

    SP Dialog framework extends the window.frameElement object, so we can use the below methods to close

    a  Modal Dialog Window in Child-page.

    1. window.frameElement.commonModalDialogClose(DialogResult dialogResult, Object returnVal)

    2. window.frameElement.commitPopup(Object returnVal)

    3. window.frameElement.cancelPopUp()

    More information is here:

    Best Regards,

    Dennis Guo

    Friday, August 30, 2013 1:51 AM
  • Hi,

    Can you try with this when you want to close the popup?

    Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>"); Response.Flush(); Response.End();



    sharath kumart shivarama

    Friday, August 30, 2013 2:35 AM
  • Hi John,

    Did you try window.close(); ?


    ******If a post answers/helps your question, please click "Mark As Answer" on that post and/or "Vote as Helpful*******

    Friday, August 30, 2013 5:57 AM