有没有办法在单击特定按钮时将当前页面保存为书签,并将该页面链接保存到网站的用户帐户中“不保存到浏览器中”作为书签?
我想使用 javascript/jquery 或 ajax 在 html 中创建这个东西...
可能吗?
最佳答案
使用此代码,您将获得跨浏览器解决方案...
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.');
关于javascript - 有没有办法在单击特定按钮时将当前页面保存为书签,并将该页面链接作为书签保存到用户个人资料中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21364370/