有没有办法在单击特定按钮时将当前页面保存为书签,并将该页面链接保存为用户配置文件作为书签?

时间:2014-01-26 14:08:07

标签: javascript html ajax jquery

有没有办法在点击特定按钮时将当前页面保存为书签,并将该页面链接保存到网站的“不以浏览器保存为”书签的用户帐户?

我想使用javascript / jquery或ajax ...

在html中创建这个东西

有可能吗?

1 个答案:

答案 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.');
相关问题