Bookmark on click using jQuery

后端 未结 4 1085
北荒
北荒 2020-12-06 10:49

Is there a way to save the current page as a bookmark (through jQuery or otherwise) when a specific button is clicked?

4条回答
  •  [愿得一人]
    2020-12-06 11:32

    Try this:

    if (window.sidebar) // firefox
        window.sidebar.addPanel(title, url, "");
    else if(window.opera && window.print){ // opera
        var elem = document.createElement('a');
        elem.setAttribute('href',url);
        elem.setAttribute('title',title);
        elem.setAttribute('rel','sidebar');
        elem.click();
    } 
    else if(document.all)// ie
        window.external.AddFavorite(url, title);
    }
    

提交回复
热议问题