Hiding browser chrome

この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ 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

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

 このページの貢献者: zhangpin04, Sheppy
 最終更新者: zhangpin04,