Javascript 无法从服务器端关闭fancybox

Javascript 无法从服务器端关闭fancybox,javascript,c#,jquery,asp.net,Javascript,C#,Jquery,Asp.net,我试过这个: if (pdfDocumentinBytes!= null) { Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.ContentType = "application/pdf"; Response.AppendHeader("Content", "attachment; filename=" + this.documentName + "

我试过这个:

if (pdfDocumentinBytes!= null)
{
    Response.Clear();
    Response.ClearHeaders();
    Response.ClearContent();
    Response.ContentType = "application/pdf";
    Response.AppendHeader("Content", "attachment; filename=" + this.documentName + ".pdf");
    Response.BinaryWrite(pdfDocumentinBytes);
    Response.End();
}

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "fancyboxClose();", true);

fancyboxClose()
是一个函数,当从服务器端调用时,它只会关闭fancybox。

需要在响应后关闭fancybox。end这听起来像是XY问题。为什么要尝试从服务器关闭模式窗口?因为pdf是在响应结束后下载的,我需要在下载时计时。所以