perymimon
10/31/2015 - 6:37 PM

Add to Bookmark

work in Firefox, IE, Opera . not work on IE when protocol is 'javascript'

function addToBookmark(title,href){
    if (window.sidebar && window.sidebar.addPanel) { // Mozilla Firefox Bookmark
      window.sidebar.addPanel(title,href,'');
    } else if(window.external && ('AddFavorite' in window.external)) { // IE Favorite
      window.external.AddFavorite(href, title);
    } else if(window.opera && window.print) { // Opera Hotlist
      this.title = title;
        return true;
    } else { // webkit - safari/chrome
        alert('Press ' + (navigator.userAgent.toLowerCase().indexOf('mac') != - 1 ? 'Command/Cmd' : 'CTRL') + ' + D to bookmark this page.');
    }
}