Home > Web Front-end > JS Tutorial > JS code for adding web page desktop shortcuts is compiled in detail_javascript skills

JS code for adding web page desktop shortcuts is compiled in detail_javascript skills

WBOY
Release: 2016-05-16 17:45:18
Original
1729 people have browsed it

Copy code The code is as follows:

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("The operation is not allowed at the current IE security level!");
}
}
Create shortcut


Copy code The code is as follows:





Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template