JQUERY implementation added to the Favorites feature

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.