Skip to content

Instantly share code, notes, and snippets.

@meandavejustice
Created September 5, 2016 15:52
Show Gist options
  • Save meandavejustice/77d2019bd0fb71d25fde5eb38573b9e6 to your computer and use it in GitHub Desktop.
Save meandavejustice/77d2019bd0fb71d25fde5eb38573b9e6 to your computer and use it in GitHub Desktop.
Get browser document dimensions from Firefox SDK Panel (thanks @6a68)
const { getMostRecentBrowserWindow, getXULWindow } = require('sdk/window/utils');
module.exports = getDocumentDimensions;
function getDocumentDimensions() {
let chromeWindow = getMostRecentBrowserWindow();
if (!chromeWindow.document) {
chromeWindow = getXULWindow(chromeWindow);
}
return chromeWindow.document.documentElement.getBoundingClientRect();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment