JavaScript adds favorites (compatible with Internet explorer firefox and chrome)

  • 2020-03-30 02:48:22
  • OfStack

Implementation code:

function addFav(){
    window.external.addFavorite('','FREE Web Directory');
    }else if(window.sidebar){
      window.sidebar.addPanel('FREE Web Directory', '','');

<a href="" 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.

Related articles: