jQuery“添加到书签”;
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jQuery“添加到书签”;相关的知识,希望对你有一定的参考价值。
works in all the major browsers that support adding to bookmarks, FF, IE, Opera. Safari and Chrome dont support this, so for them, a nice message :)
$("a#bookmark").click(function(){ var bookmarkUrl = this.href; var bookmarkTitle = this.title; if ($.browser.mozilla) // For Mozilla Firefox Bookmark { window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,""); } else if($.browser.msie || $.browser.webkit) // For IE Favorite { window.external.AddFavorite( bookmarkUrl, bookmarkTitle); } else if($.browser.opera ) // For Opera Browsers { $(this).attr("href",bookmarkUrl); $(this).attr("title",bookmarkTitle); $(this).attr("rel","sidebar"); $(this).click(); } else // for other browsers which does not support { alert('Please hold CTRL+D and click the link to bookmark it in your browser.'); } return false; });
以上是关于jQuery“添加到书签”;的主要内容,如果未能解决你的问题,请参考以下文章