Skip to content

Instantly share code, notes, and snippets.

@ckarlof
Created February 5, 2013 18:31
Show Gist options
  • Save ckarlof/4716521 to your computer and use it in GitHub Desktop.
Save ckarlof/4716521 to your computer and use it in GitHub Desktop.
Open a window in private browsing mode from a Firefox add-on. Uses a deprecated interface. CMON, recommend a replacement please! https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIPrivateBrowsingService
const {Cc,Ci} = require("chrome");
var pbs = Cc["@mozilla.org/privatebrowsing;1"].getService(Ci.nsIPrivateBrowsingService);
pbs.privateBrowsingEnabled = true;
var windows = require("sdk/windows").browserWindows;
windows.open("https://www.google.com");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment