知道html代码,实现下载

我已经获取到了html代码,然后使用window.open("");可以打开页面,展示出来了,但是有了html代码,如何实现下载呢,下载的是一个网页,哪位大神帮忙看看

设置请求头为 Accept=text/plain; charset=utf-8

你一定要用window.open吗,要不你百度下原生JS如何设置请求头,正常这个都是在服务器端设置的

       url: "http://test.com",  
       dataType: 'json',  
       type: 'GET',  
       beforeSend: function (xhr) {  
           xhr.setRequestHeader("Test", "testheadervalue");  
       },  
       async: false,  
       cache: false,  
       //contentType: 'application/x-www-form-urlencoded',  
       success: function (sResponse) {  
       }  
   });  

这个问题我已经解决了,谢谢各位
其实我是用的是超链接实现的