We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

Archive of obsolete content

Hiding browser chrome

Jump to:

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

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, zhangpin04, Sheppy
 Last updated by: zhangpin04,