最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to tell Firefox to hide the element identified by "CustomizableUI.AREA_BOOKMARKS"? - Stack Ov

programmeradmin4浏览0评论

On MDN, it states here that the element ID for the Bookmarks sidebar is reported by

  • CustomizableUI.AREA_BOOKMARKS

Can someone please tell me how I can use that to force Firefox to hide the Bookmarks sidebar? I don't want a "toggle" function because, I need to ignore whichever state it might be in, at the time of the JavaScript call from the loaded HTML page, and force a "hidden", "collapsed" or "not-displayed" mode.

I tried the following as inline scripting, but it did not have the desired effect, likely because I don't have the proper references to tell the browser properly.

<script>
    var sidebar = browser.getElementById("CustomizableUI.AREA_BOOKMARKS") ;
    sidebar.hide() ;
</script>

I've also tried the following without success:

<script>
    browser.action.closePanel ;
    browser.action.closeSidebar ;
</script>

Finally, even the specific directive given here does not work:

<script>
    browser.sidebarAction.close() ;
</script>

Help, please!

To clarify, this action must work in the new window opened at command line,

firefox -new-window ./myPage.html &

even while a pre-existing browser session is operating with the Bookmarks sidebar open (and staying open).

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论