首頁 > web前端 > js教程 > 通过修改referer下载文件的方法_JavaScript

通过修改referer下载文件的方法_JavaScript

WBOY
發布: 2016-05-16 19:04:49
原創
1840 人瀏覽過

GetFile.wsc

复制代码 代码如下:

 
 
   
   
     
     
     
     
       
    
 
     
       
    
 
  
 
   
     
  
 
   
  <script> <BR> <![CDATA[ <BR>var Referer, Content, Data; <BR>var Stream = new ActiveXObject("ADODB.Stream"); <BR>Stream.Type = 1; <BR>function onReady() <BR>{ <BR> if(Http.readyState == 4) <BR> { <BR> Content = Http.responseText; <BR> Data = Http.responseBody; <BR> fireEvent("ondowncomplete"); <BR> Http.abort(); <BR> } <BR>} <BR>function GetFile(URL) <BR>{ <BR> Http.onreadystatechange = onReady; <BR> Http.open("GET", URL, true, "", ""); <BR> if(Referer) Http.setRequestHeader("Referer", Referer); <BR> Http.send(null); <BR>} <BR>function Save(Path) <BR>{ <BR> Stream.Open(); <BR> Stream.Write(Data); <BR> Stream.SaveToFile(Path, 2); <BR> Stream.Close(); <BR>} <BR> ]]> <BR> </script> 
  

test.hta
复制代码 代码如下:

<script> <BR>var Down = document.createElement("Comment"); <BR>document.lastChild.lastChild.appendChild(Down); <BR>Down.style.behavior="url(GetFile.wsc)"; <BR>Down.ondowncomplete = function() <BR>{ <BR> //document.write(Down.Content); <BR> Down.Save(SaveTo.value); <BR> Go.disabled=0; <BR> alert("OK"); <BR>} <BR>function GetFile() <BR>{ <BR> Go.disabled = 1; <BR> Down.Referer = Referer.value; <BR> Down.GetFile(URL.value); <BR>} <BR></script> 
 
URL: 
 
Referer: 
 
SaveTo: 
 
 
 
相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板