About the "Add to the collection" of the code, many people will not pay attention to, the general situation is random on the Internet to search a code on the page on the hastily. But they are not compatible with mainstream browsers. Below you'll share a feature that uses JQuery to add favorites.
<a id="addcollect" href="#">加入收藏夹</a>
$ (document). Ready (function() { $("#addcollect"). Click (function() { varCTRL = (Navigator.userAgent.toLowerCase ()). IndexOf (' mac ')! =-1? ' Command/cmd ': ' CTRL '; if(document.all) {Window.external.addFavorite (' http://www.baidu.com ', ' front-end notes ') } Else if(Window.sidebar) {Window.sidebar.addPanel (' Front-end notes ', ' http://www.baidu.com ', ' ") } Else{alert (' You can try using the shortcut key ' + Ctrl + ' + D to add to Favorites ~ ') } })});
JQUERY implementation added to the Favorites feature