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