JS code to add web page desktop shortcut

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

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326661374&siteId=291194637