且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 JavaScript 添加到浏览器收藏夹/书签但适用于所有浏览器(我的不适用于 Chrome)?

更新时间:2023-11-21 09:47:04

抱歉,没有跨浏览器的方式来做到这一点.您的 FF 示例也已损坏:它不会创建常规书签,而是设置要在侧边栏中打开的书签.你必须使用书签服务来创建一个实际的书签,但这'会因安全限制而失败.

Sorry, but there's no cross-browser way to do this. Your FF example is broken as well: It won't create a regular bookmark, but a bookmark set to be opened in the sidebar. You'd have to use the bookmark-service to create an actual bookmark, but this'll fail due to security restrictions.