JS 添加网页桌面快捷方式的代码

<script>
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>
</head>
<body>
    <a href=”javascript:void(0);” onclick=”toDesktop(‘http://zl.aisky.net/&#8217;,’小龙驿站’)”>创建快捷方式</a>
</body>

猜你喜欢

转载自u012081441.iteye.com/blog/2382961