把网址添加到桌面-在本地创建网站的快捷方式

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 3 <head>
 4     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
 5     <title></title>
 6 </head>
 7 <body>
 8     <script language="JavaScript">
 9         function toDesktop(sUrl,sName){
10         try   
11           {  
12          var WshShell = new ActiveXObject("WScript.Shell");
13          var oUrlLink = WshShell.CreateShortcut(WshShell.SpecialFolders("Desktop") + "\\" + sName + ".url");
14          oUrlLink.TargetPath = sUrl;
15          oUrlLink.Save();
16           }   
17           catch(e)   
18           {
19                   alert("当前IE安全级别不允许操作!");   
20           }
21         }
22     </script>
23 <input name="btn" type="button" id="btn" value="百度" onClick="toDesktop('http:\//www.baidu.com/','百度')">
24 <input name="btn" type="button" id="btn" value="C盘" onClick="toDesktop('file:\//C:','C盘')">
25 </body>
26 </html>

方法二:

 1 <?php
 2 $Shortcut = "[InternetShortcut]
 3 URL=http://www.baidu.com/
 4 IDList=
 5 [{000214A0-0000-0000-C000-000000000046}]
 6 Prop3=19,2
 7 ";
 8 Header("Content-type: application/octet-stream");
 9 header("Content-Disposition: attachment; filename=百度.url;");
10 echo $Shortcut;
11 ?>

posted on 2012-09-27 19:19  dudumao  阅读(2090)  评论(0编辑  收藏  举报

导航

阿里云