js| Download
/*bluedestiny (Blue fate) * *
Download hotlinking questions, the beholder, the benevolent; here is only a purely discussion technique.
If it is the page anti-theft chain, the usual method is to use ServerVariables ("SERVER_NAME") combined with ServerVariables ("Http_referer") to prevent. As follows:
DIM Servurl, Fromurl
Servurl = Request.ServerVariables ("SERVER_NAME")
Fromurl = Request.ServerVariables ("Http_referer")
If (Mid (Fromurl,8,len (Servurl))) <> Servurl Then
Response.Write (' <script>alert (' please login from the right page! ') </script> ")
Response.End
Else
......
End If
There is also a combination of session to prevent page hotlinking and file hotlinking.
Then there is the server side to set.
The above method, I will write out in the future article, below let us see how to use JavaScript (pure static file) How to prevent file hotlinking? The following source code only to play a role, I hope that we have more comments.
---------------------------------------------------------------------
**********************************************
First, for example, we have a music audio-visual page. The source code is as follows:
First build a folder is: MusicMP3, under this folder put a Mp3,mp3 renamed to 921239.mp3
---------------------------------------------------------------------
***********************************
music.htm
-----------------
<title>music</title
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312"
<script Language= "JavaScript"
Function play (URL) {
play_win=window.open (' play.htm?url= ' +url, ' Bluedestiny ', ' Toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no, copyhistory=no,width=470,height=290,top=210,left=158 ');
}
</script>
<body>
<p> <a href= "#" >MUSIC1</A></P>
</body
How can there be a long string of characters? Note The format of this long string of parameters, which is useful later.
---------------------------------------------------------------------------------
**************************************************
About preventing file download hotlinking use JS to prevent file address hotlinking (ii)
Http://blog.csdn.net/bluedestiny/archive/2004/09/23/114164.aspx
---------------------------------------------------------------------------