有没有办法在点击特定按钮时将当前页面保存为书签,并将该页面链接保存到网站的“不以浏览器保存为”书签的用户帐户?
我想使用javascript / jquery或ajax ...
在html中创建这个东西有可能吗?
答案 0 :(得分:3)
使用此代码,您可以使用跨浏览器解决方案......
if (window.sidebar && window.sidebar.addPanel) // Mozilla Firefox Bookmark
window.sidebar.addPanel(document.title,window.location.href,'');
else if(window.external && ('AddFavorite' in window.external)) // IE Favorite
window.external.AddFavorite(location.href,document.title);
else if(window.opera && window.print) // Opera Hotlist
this.title=document.title;
else // webkit - safari/chrome
alert('Press ' + (navigator.userAgent.toLowerCase().indexOf('mac') != - 1 ? 'Command/Cmd' : 'CTRL') + ' + D to bookmark this page.');