Windows 10 reached EOS (end of support) on October 14, 2025. If you are on Windows 10, see this article.

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多
Solved 封存

window.sidebar.addPanel追加的书签默认是在侧栏加载的,怎么通过js设置它不在侧栏加载?

flysky862 replied
xiayanghui

1、实现代码

<script>
function addfavorite()
{
   if (document.all)
   {
      window.external.addFavorite('URL','登录画面');
   }
   else if (window.sidebar)
   {
      window.sidebar.addPanel('登录画面', 'URL', "");
   }
}
</script> 

2、上面的代码实现了追加书签的功能,但是追加的书签默认是在侧栏加载的,请问如何通过js来设置书签的属性,使追加的书签能够在当前标签页中打开,而不是在侧栏中打开。或者能够像firefox3.6版本那样,在弹出的书签追加对话框上,有个复选框“在侧栏中载入此书签”,让用户自己做选择。

1、实现代码 <pre><nowiki><script> function addfavorite() { if (document.all) { window.external.addFavorite('URL','登录画面'); } else if (window.sidebar) { window.sidebar.addPanel('登录画面', 'URL', ""); } } </script> </nowiki></pre> 2、上面的代码实现了追加书签的功能,但是追加的书签默认是在侧栏加载的,请问如何通过js来设置书签的属性,使追加的书签能够在当前标签页中打开,而不是在侧栏中打开。或者能够像firefox3.6版本那样,在弹出的书签追加对话框上,有个复选框“在侧栏中载入此书签”,让用户自己做选择。

由 cor-el 於 修改

從原來的回覆中察看解決方案

選擇的解決方法

firefox too bad

所有回覆 (4)

You can ask visitors to press Ctrl + D to bookmark the current page. Using that JavaScript will always create a bookmark that opens in the sidebar and there is no other method to create a bookmark.

Thank you very much

選擇的解決方法

firefox too bad