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>

 

posted @ 2020-03-01 16:16  曾小慧  阅读(2332)  评论(0编辑  收藏  举报