支持ie6 ie7 ie8 firefox的javascript添加至收藏夹代码

三 2nd, 2010
function addfavor(url,title) {
    if(confirm('确定添加收藏?')){
        var ua = navigator.userAgent.toLowerCase();
        if(ua.indexOf("msie 8")>-1){
            external.AddToFavoritesBar(url,title,'slice');//IE8
        }else{
            try {
                window.external.addFavorite(url, title);
            } catch(e) {
                try {
                    window.sidebar.addPanel(title, url, "");//firefox
                } catch(e) {
                    alert("加入收藏失败,请使用Ctrl+D进行添加");
                }
            }
        }
    }
    return false;
}
标签:
目前还没有任何评论.
;) :| :x :twisted: :roll: :oops: :o :mrgreen: :lol: :idea: :evil: :cry: :arrow: :P :D :?: :? :) :( :!: 8O 8)

Spam Protection by WP-SpamFree