Auto-closing a popup with a file to download

后端 未结 4 1717
误落风尘
误落风尘 2021-02-06 16:16

I have a file, named download.php, which contains a file to be downloaded, so it has the following headers (declared with PHP):

header(\"Content-Typ         


        
4条回答
  •  悲&欢浪女
    2021-02-06 16:18

    I have used Onblure but it didn't help at all!

    I used below code and it is working for me.

    var popupWindow = window.open("endpoint","","setting");
    var att = document.createAttribute("onblure");  // Create a "onblure" attribute
    att.value = "window.close()";                  // Set the value of the class attribute
    popupWindow.setAttributeNode(att); 
    

    This will allow closing the window when download window appears

    Note: endpoint: is your new window endpoint setting: is your window setting for example width, height,top, left .. etc

提交回复
热议问题