Closing child window inParent window.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shilpajm
    New Member
    • Jul 2014
    • 3

    Closing child window inParent window.

    Hi Experts,

    I want close child window from parent window after opening/saving text document.I don't have child window code.So no control over child window in parent. I am trying to access properties & methods of child window but getting error "Permission Denied".
    Closing of child window is fine but i am not getting child window event in parent. I mean how to know that child window has completed task.

    My code is as below:

    Code:
    function checkWindow() {
                if (childWindow) {
                    window.clearInterval(intervalID);
                    childWindow.close();
                }
            }
    
      $(document).ready(function () {
                if ($("#ReportUrl").val() != "") {
                    var url = $("#ReportUrl").val();
              debugger;
                    childWindow = window.open(url);
    
                   
                    intervalID = window.setInterval(checkWindow, 500)
    }
    This is immediately closes window. And also i don't want to use timer.

    Regards,
    Shilpa
    Last edited by Dormilich; Jul 25 '14, 11:41 AM. Reason: please use code tags when posting code
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Closing of child window is fine but i am not getting child window event in parent.
    of course not. window is the endpoint of all events. everything else would be a security risk.

    I mean how to know that child window has completed task.
    the child window hast to notify the parent window explicitly
    e.g. via https://developer.mozilla.org/en-US/...ow.postMessage

    Comment

    • shilpajm
      New Member
      • Jul 2014
      • 3

      #3
      Hi Dormilich ,

      Thanks for your reply.

      I went through the link. But problem is that i don't have control over client script as client script is not with me.

      I am just calling window.open(chi ldurl) function in parent.


      Regards,
      Shilpa

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        But problem is that i don't have control over client script as client script is not with me.
        then you can do nothing if you cannot change the JS files.

        Comment

        • shilpajm
          New Member
          • Jul 2014
          • 3

          #5
          Hi Dormilich,

          Thanks for your reply.

          Regards,
          Shilpa

          Comment

          Working...