【问题标题】:Is there a way to save the current page as a bookmark when a specific button is clicked and save that page link into user profile as a bookmark? [duplicate]有没有办法在单击特定按钮时将当前页面保存为书签并将该页面链接作为书签保存到用户配置文件中? [复制]
【发布时间】:2014-01-26 22:24:02
【问题描述】:
有没有办法在单击特定按钮时将当前页面保存为书签,并将该页面链接作为书签保存到网站的用户帐户中“不保存到浏览器中”?
我想使用 javascript/jquery 或 ajax 在 html 中创建这个东西...
有可能吗?
【问题讨论】:
标签:
javascript
html
ajax
jquery
【解决方案1】:
有了这个代码,你就有了一个跨浏览器的解决方案......
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.');