用asp实现网址的桌面快捷方式下载,就是访问asp文件的时候,实现下载网址的快捷方式,就像我们手动在桌面创建一样。 

 

方法:新建一个PHP文档:名字好记就行如:shortcut.asp

 

asp文档中的内容: 

 

 

 

 
  
  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.asp

[js方法]
 

 
  
  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/’,'博士吧’)“>