jquery 添加到收藏夹

下面的代码是通过网上别人写的javascript添加到收藏夹进行改写成jquery形式的;

<script language="javascript" src="jquery-1.3.1.js"></script> //导入jquery插件
<script language="javascript">
$(document).ready(function(){
   $("#btn").click(function(){
      var ctrl = (navigator.userAgent.toLowerCase()).indexOf('mac') != -1 ? 'Command/Cmd':'Ctrl';
   if(document.all)
   {
      window.external.addFavorite(window.location,document.title);
   }
   else if(window.sidebar)
   { 
       window.sidebar.addPanel(document.title,window.location);
   }
   else{
       alert('添加失败,请用Ctrl+D进行添加');
   }
   });
});
</script>

<body>

<input type="button" id="btn" value="加入收藏夹" />
</body>

技术文档
原文地址:https://www.cnblogs.com/ishibin/p/2797165.html