我正在使用代码从弹出窗口导出pdf文件 .
单击按钮
function popupReport()
{
var url = 'Report.aspx';
window.open(url, 'winPopupReport', 'width=300,height=300,resizable=no,scrollbars=no,toolbar=no,directories=no,status=no,menubar=no,copyhistory=no');
return false;
}
并在Report.aspx.cs中
ReportDocument repDoc = ( ReportDocument ) System.Web.HttpContext.Current.Session["StudyReportCrystalDocument"];
// Stop buffering the response
Response.Buffer = false;
// Clear the response content and headers
Response.ClearContent();
Response.ClearHeaders();
try
{
repDoc.ExportToHttpResponse( CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "StudyReport" );
}
catch( Exception ex )
{
}
该代码在IE7中运行良好 . 但是在IE6中弹出窗口没有关闭 . 为什么会这样?
1 回答
某些浏览器在某些情况下拒绝自动关闭网页 .
试试这个workround关闭页面 .
在要关闭的页面中编写一个脚本,打开另一个页面;在此示例中,脚本在单击按钮后通过代码注入,但如果需要,可以直接在HTML中编写脚本 .
以这种方式创建Success.htm页面