IE8.0添加收藏夹

 <script language=""javascript"">
                function AddFav(url,title) {
                    if(confirm(""网站名称:""+title+""/n网址:""+url+""/n确定添加收藏?"")){
                    var ua = navigator.userAgent.toLowerCase();
                    if(ua.indexOf(""msie 8"")>-1){
                    window.external.AddToFavoritesBar(url,title,'IT有道');//IE8
                    }else{
                    try {
                    window.external.addFavorite(url, title);
                    } catch(e) {
                    try {
                    window.sidebar.addPanel(title, url,"""");//firefox
                    } catch(e) {
                    alert(""加入收藏失败,请使用Ctrl+D进行添加"");
                    }
                    }
                    }
                    }
                  
                }
            </script>

 

 

 

 

<a  href=""javaScript:AddFav(document.location,document.title)"">加入收藏</a>

你可能感兴趣的:(JavaScript,function,IE,url)