搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

add bookmark using javascript, it opens in the sidebar, not in the main window

  • 5 个回答
  • 35 人有此问题
  • 6 次查看
  • 最后回复者为 Aimhere

more options

im using this function:

function add_bookmark(){ var title = "My Title"; var url = "www.myurl.com"; window.sidebar.addPanel(title, url, ""); }

it successfully creates a bookmark but when i click on it, it just opens in the sidebar and not in the main window.

im using this function: function add_bookmark(){ var title = "My Title"; var url = "www.myurl.com"; window.sidebar.addPanel(title, url, ""); } it successfully creates a bookmark but when i click on it, it just opens in the sidebar and not in the main window.

所有回复 (5)

more options

Don't use that function as it selects the "Open this bookmark in the sidebar" feature in Properties for the bookmark. That is the way it works in Firefox and it probably won't ever be fixed. Someone filed a Bug about fixing that in Firefox back in 2004 or 2005, and the Mozilla developers marked it as WONTFIX due to perceived security issues with scripts of that sort.

more options

so there's still no solution for this problem after all. just tell the users to press Ctrl-D instead.

but what probably will be the issues when allowing such scripts, if they can allow scripts to create and open bookmarks in the sidebar, why not allow it to open in the main window?

tnx! ^_^

more options

Sorry, I don't recall what the perceived security issue was. I didn't bookmark that particular Bug report and I couldn't find it an hour ago when I searched for it for this thread. IIRC, that was the exact recommendation in the Bug report, just tell Firefox users to use {Ctrl+D} to Bookmark the page.

6 or 7 years ago I searched the free JavaScript websites, like Dynamic Drive, for "Bookmark the Page" type scripts and found three different scripts, two that worked in IE-only and just one that was labeled for "Netscape". That "Netscape" version was the one that "ticked" the "Open this bookmark in the sidebar" in Firefox.

more options

Bug 305398 - JavaScript sidebar.addpanel should have similar behaviour as adding bookmark manually
Bug 214530 - Need Way to Create Bookmarks From Pages.
Bug 66248 - (AddBookmark) [RFE] Ability for page javascript to add bookmark

more options

A page I had bookmarked kept opening in the sidebar... it was driving me crazy until I found the answer on this forum. Further research led to this thread. I have to ask, if script-based creation of bookmarks is a security risk, why still allow scripts to create bookmarks at all (much less ones that only open in the Sidebar)?

It's not enough to tell users (after the fact!) that they need to bookmark pages from Firefox itself. People are going to see those "Bookmark this page" buttons on websites and click on them...

The developers really need to fix this once and for all.