You cannot really launch Firefox with a new url in a private window AFAIK. -private-window <url>
will open a new private window, but still put the new tab in a regular one.
Chrome can be launched with chrome --incognito <url>
, however you would need to launch it yourself via nsIProcess
and therefore would first have to figure out where the chrome binary is.
If you can guarantee that the default handler is Chrome, then you might use nsIExternalProtocolService.getProtocolHandlerInfo()
, use preferredApplicationHandler
and QueryInterface
that to nsILocalHandlerApp
to find the .executable
. Otherwise, you'll have to deal with the OS and/or known paths yourself.