如何在新窗口中打开HTML文件 [英] How to open html file in new window
问题描述
我正在为不同的文件类型(xml html pdf等)创建一个html页面的小导出模块.
当我将页面导出为html时,会出现弹出的文件下载.
到目前为止很好,但是,
当我选择打开它时,它会在当前窗口中打开.
如何在另一个窗口或选项卡中打开它?
在此先感谢
这是我的代码
StringBuilder str = new StringBuilder();
str.Append(< HTML>");
str.Append(< HEAD>");
str.Append(< TITLE></TITLE>"));
str.Append(</HEAD>");
str.Append(< BODY>");
str.Append(< CENTER>");
此.page.Response.Clear();
this.page.Response.AddHeader("content-disposition","attachment; filename = StationData.htm");
this.page.Response.Charset =" ;
this.page.Response.ContentType ="application/vnd.html";
System.IO.StringWriter stringWrite =新的System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
this.page.Response.Write(str.ToString());
this.page.Response.End();
Hi,
Im creating some little export module of an html page to different file type (xml html pdf etc)
When im exporting the page to html the file download pop up appears.
so far so good , however,
When I choose to open it , it opens on the current window.
How do i open it in another window or tab
thanks in advance
here is my code
StringBuilder str = new StringBuilder();
str.Append("<HTML>");
str.Append("<HEAD>");
str.Append("<TITLE></TITLE>");
str.Append("</HEAD>");
str.Append("<BODY>");
str.Append("<CENTER>");
this.page.Response.Clear();
this.page.Response.AddHeader("content-disposition","attachment;filename=StationData.htm");
this.page.Response.Charset = "";
this.page.Response.ContentType = "application/vnd.html";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
this.page.Response.Write(str.ToString());
this.page.Response.End();
推荐答案
使用javascript中的Window.Open
,然后调用处理程序,该处理程序会为您提供您创建的响应.
[玫瑰]
useWindow.Open
from javascript and then call the handler which give you the response you created.
[Rose]
这篇关于如何在新窗口中打开HTML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!