js实现IE/Firefox的收藏功能
生活随笔
收集整理的這篇文章主要介紹了
js实现IE/Firefox的收藏功能
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
代碼:
function addFavorite(el){var url = window.location.href,title = $('head').find('title').html();try{//IEwindow.external.AddFavorite(url, title);}catch(e){ //Firefoxtry{window.sidebar.addPanel(title,url,'');}catch(e){if(window.opera){ //operael.href = url;el.title = title;el.rel = 'sidebar';}else{alert('Sorry, your browser does not support this action, please bookmark this page manually by pressing Ctrl + D on PC or Cmd + D on Mac.');}}}}支持IE、Firefox和opera。
調用方法:
<a href="javascript:addFavorite(this);">收藏</a>
轉載于:https://www.cnblogs.com/jinphen/p/ie_firefox_add_favorite.html
總結
以上是生活随笔為你收集整理的js实现IE/Firefox的收藏功能的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Hadoop到底能做什么?怎么用hado
- 下一篇: ldap无法启动 system libr