用asp实现网址的桌面快捷方式下载,就是访问asp文件的时候,实现下载网址的快捷方式,就像我们手动在桌面创建一样。
方法:新建一个PHP文档:名字好记就行如:shortcut.asp
asp文档中的内容:
- <%
- id=request("id")
- liehuo_net_url=request("liehuo_net_url")
- If liehuo_net_url="" Then liehuo_net_url="烈火学院"
- Shortcut = "[InternetShortcut] " & vbCrLf
- Shortcut = Shortcut & "URL=http://www.veryhuo.com/?desktop" & vbCrLf
- Shortcut = Shortcut & "IDList=" & vbCrLf
- Shortcut = Shortcut & "IconFile=http://www.veryhuo.com/favicon.ico" & vbCrLf
- Shortcut = Shortcut & "IconIndex=1" & vbCrLf
- Shortcut = Shortcut & "[{000214A0-0000-0000-C000-000000000046}] " & vbCrLf
- Shortcut = Shortcut & "Prop3=19,2 " & vbCrLf
- Shortcut = Shortcut & " " & vbCrLf
- Response.AddHeader "Content-Disposition", "p_w_upload;filename="&liehuo_net_url&".url;"
- Response.ContentType = "application/octet-stream"
- Response.Write Shortcut
- %>
演示:http://www.veryhuo.com/plus/shortcut.asp
[js方法]
- <script language=“JavaScript“>
- function toDesktop(sUrl,sName)
- {
- try
- {
- var WshShell =
- new ActiveXObject(“WScript.Shell”);
- var oUrlLink = WshShell.CreateShortcut(WshShell.SpecialFolders(“Desktop”) +
- “\\”
- + sName +
- “.url”);
- oUrlLink.TargetPath = sUrl;
- oUrlLink.Save();
- }
- catch(e)
- {
- alert(“当前IE安全级别不允许操作!请设置后在操作.”);
- }
- }
- </script>
<input name=“btn“ type=“button“ id=“btn“ value=“创建的快捷方式“ onClick=“toDesktop(‘http:\//www.boshi8.com/’,'博士吧’)“>