Visit Mozilla.org

Full page zoom

From MDC

This article covers features introduced in Firefox 3

Introduced in Gecko 1.9


Full page zoom (or just fullZoom) is a new feature to probably come with Firefox 3. You may use it on current trunk builds since Gecko 1.9a7. While there is currently no UI you may use JavaScript and the nsIMarkupDocumentViewer XPCOM interface.

[edit] Example (xul:browser)

The following example demonstrates the use for the current focused browser window. This is the typical usage for a Firefox extension.

var zoom = 1.5;
var docViewer = getBrowser().mCurrentBrowser.markupDocumentViewer;
docViewer.fullZoom = zoom;

[edit] Example (xul:iframe)

You may use the fullZoom feature for a xul:iframe as well. However, because an iframe doesn't have a markupDocumentViewer property, we need to get that first:

var zoom = 1.5;
var iframe = document.getElementById("authorFrame");
var contViewer = iframe.docShell.contentViewer;
var docViewer = contViewer.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);
docViewer.fullZoom = zoom;

[edit] References