ASP 實現網址的桌面快捷方式下載

用asp實現網址的桌面快捷方式下載,就是訪問asp文件的時候,實現下載網址的快捷方式,就像咱們手動在桌面建立同樣。 安全

 

方法:新建一個PHP文檔:名字好記就行如:shortcut.aspapp

 

asp文檔中的內容: ide

 

 

 

  
  
  
  
  1. <%   
  2.  
  3. id=request("id")   
  4.  
  5. liehuo_net_url=request("liehuo_net_url")   
  6.  
  7. If liehuo_net_url="" Then liehuo_net_url="烈火學院"   
  8.  
  9. Shortcut = "[InternetShortcut] " & vbCrLf   
  10.  
  11. Shortcut = Shortcut & "URL=http://www.veryhuo.com/?desktop" & vbCrLf   
  12.  
  13. Shortcut = Shortcut & "IDList=" & vbCrLf   
  14.  
  15. Shortcut = Shortcut & "IconFile=http://www.veryhuo.com/favicon.ico" & vbCrLf   
  16.  
  17. Shortcut = Shortcut & "IconIndex=1" & vbCrLf   
  18.  
  19. Shortcut = Shortcut & "[{000214A0-0000-0000-C000-000000000046}] " & vbCrLf   
  20.  
  21. Shortcut = Shortcut & "Prop3=19,2 " & vbCrLf   
  22.  
  23. Shortcut = Shortcut & " " & vbCrLf   
  24.  
  25. Response.AddHeader "Content-Disposition""p_w_upload;filename="&liehuo_net_url&".url;"   
  26.  
  27. Response.ContentType = "application/octet-stream"   
  28.  
  29. Response.Write Shortcut   
  30.  
  31. %>  
  32.  

演示:http://www.veryhuo.com/plus/shortcut.aspurl

[js方法]
 spa

  
  
  
  
  1. <script language=「JavaScript「>  
  2.  
  3. function toDesktop(sUrl,sName)  
  4. {  
  5. try 
  6. {  
  7. var WshShell =  
  8. new ActiveXObject(「WScript.Shell」);  
  9. var oUrlLink = WshShell.CreateShortcut(WshShell.SpecialFolders(「Desktop」) +  
  10. 「\\」  
  11. + sName +  
  12. 「.url」);  
  13. oUrlLink.TargetPath = sUrl;  
  14. oUrlLink.Save();  
  15. }  
  16. catch(e)  
  17. {  
  18. alert(「當前IE安全級別不容許操做!請設置後在操做.」);  
  19. }  
  20. }  
  21. </script>  
  22.  

<input name=「btn「 type=「button「 id=「btn「 value=「建立的快捷方式「 onClick=「toDesktop(‘http:\//www.boshi8.com/’,'博士吧’)「>ip

相關文章
相關標籤/搜索