liwei-blog/js/add-bookmark.js

19 lines
740 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function join_favorite(siteUrl, siteName){
//捕获加入收藏过程中的异常
try{
//判断浏览器是否支持document.all
if(document.all){
window.external.addFavorite(siteUrl, siteName);
//如果支持则用external方式加入收藏夹
}else if(window.sidebar){
window.sidebar.addPanel(siteName, siteUrl, '');
//如果支持window.sidebar则用下列方式加入收藏夹
}else{
alert("当前使用浏览器需要使用 Ctrl+D 快捷键添加书签!");
}
//处理异常
}catch(e){
alert("当前使用浏览器需要使用 Ctrl+D 快捷键添加书签!");
}
}