Home  >  Article  >  Web Front-end  >  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
WBOYOriginal
2016-05-16 17:45:181689browse

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:





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