Skip to content

Instantly share code, notes, and snippets.

@darktrojan
Created July 17, 2012 23:53
Show Gist options
  • Save darktrojan/3133007 to your computer and use it in GitHub Desktop.
Save darktrojan/3133007 to your computer and use it in GitHub Desktop.
zoom to fit the viewport width from metadata
{
let ww = gBrowser.selectedBrowser.boxObject.width;
let wu = gBrowser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
let w = parseFloat(wu.getDocumentMetadata("viewport-width"));
//gBrowser.contentDocument.documentElement.style.width = w + 'px';
if (!isNaN(w))
ZoomManager.zoom = ww/w;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment