JavaScript adds favorites (compatible with Internet explorer firefox and chrome)
- 2020-03-30 02:48:22
- OfStack
Implementation code:
<script>
function addFav(){
if(document.all){
window.external.addFavorite('http://jb51.net','FREE Web Directory');
}else if(window.sidebar){
window.sidebar.addPanel('FREE Web Directory', 'http://jb51.net','');
}
}
</script>
<a href="http://jb51.net" title="FREE Web Directory" rel="sidebar" onclick="addFav();"> Join the collection </a></div>
Javascript added to favorites requires attention to one detail if < A> There is no "rel=sidebar" above, so it will report an error: window.sidebar. AddPanel is not a function.