mozilla
Your Search Results

    Hiding browser chrome

    この記事はまだ日本語に翻訳されていません。MDN の翻訳はボランティアによって行われています。是非 MDN に登録し、私たちの力になって下さい。

    There are times in which an extension may find it useful to hide browser chrome (that is, toolbars, the location bar, and so forth), in order to reduce clutter when presenting a particular user interface. This is done, for example, by the about:addons page.

    This can be accomplished by augmenting the behavior of the XULBrowserWindow object's hideChromeForLocation() method.

    Note: Don't simply replace the hideChromeForLocation() method; this will likely hurt the functionality of Firefox itself as well as other extensions. Use the technique demonstrated here.
    var prevFunc = XULBrowserWindow.hideChromeForLocation;
    
    XULBrowserWindow.hideChromeForLocation = function(aLocation) {
      return (/* your test goes here */) || prevFunc.apply(XULBrowserWindow, [aLocation]);
    }

    This works by saving a reference to the current implementation of the hideChromeForLocation() method, then replacing it with a new method that calls through to the previous implementation. By chaining multiple implementations of the method together in this way, everyone that wants to hide chrome can do so when appropriate.

    See also

    ドキュメントのタグと貢献者

    Contributors to this page: Sheppy, zhangpin04
    最終更新者: zhangpin04,