javascript - 有没有办法在单击特定按钮时将当前页面保存为书签,并将该页面链接作为书签保存到用户个人资料中?

标签 javascript html ajax jquery

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

我想使用 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/

相关文章:

javascript - 如何仅在第一页加载时调用 javascript 函数

javascript - 更改父级的兄弟类

javascript - 有没有办法从 ajax 预检请求中获取调试信息?

ajax - JSON REST Get-Request 正在等待 Tomcat for Chrome/Firefox 上的 CORS

javascript - 可以加载外部 html 作为中途停留的按钮吗?

javascript - Adobe Air - 检测 javascript 事件

javascript - 网络音频离线上下文和分析器节点

jquery - 奇怪的下拉菜单jquery

javascript - AngularJS 脚本运行了两次

PHP - 好的安全投票方式?