Private_Tab
                                
                                 Private_Tab copied to clipboard
                                
                                    Private_Tab copied to clipboard
                            
                            
                            
                        Toolbar button to toggle private mode
Hi,
Private Tab includes a toolbar button to open a page in Private mode as well as an option to toggle private mode from the page''s tab menu.
Would it be possible to include a toolbar button which performs what the tab menu does, that is simply toggling Private Mode for the present page?
I've spent hours trying to at least create a bookmarklet which would simply perform a sendkeyevent, that is ctrl+alt++T in order to simulate private mode toggling, but unsuccessfully.
So, either a new toolbar button or the script to simulate ctrl+alt+t in order to create the bookmarklet/button would be much appreciated.
Thanks!
This is not possible using bookmarklets: scripts with regular privileges can't access private things for privacy and security reasons... E.g. you can add private: before URL to load page in private mode, but only manually (or from some another extension).
So, only privileged code can simulate hotkey, but  privileged code can just use API:
https://github.com/Infocatcher/Private_Tab#api-for-other-extensions
For Custom Buttons extension (for "code" section in the button editor):
privateTab.toggleTabPrivate(gBrowser.selectedTab);
Or just like checkbox in tab context menu:
document.getElementById("privateTab-tabContext-toggleTabPrivate").doCommand();
OK- Thanks a lot, @Infocatcher
A quick word to confirm that indeed the Custom Buttons Firefox extension (which I've discovered) together with
privateTab.toggleTabPrivate(gBrowser.selectedTab);
does the job I was aiming. Nice.
In fact I use two pages as "Home" pages, a customized Mozilla Firefox Start Page and the Super Start Firefox extension page, so being able to toggle each to Private Tab mode brings me extra comfort.
Thanks again for your efficient help, @Infocatcher