How to open a page in incognito mode from HTML?
Solution 1:
You may achieve that with the JavaScript function windows.create()
, it accepts an optional incognito
parameter, see MDN web docs:
incognito
Whether the new window should be an incognito (private) window. Note that if you specify incognito and tabId, the ID must refer to a private tab — that is, you can't move a non-private tab to a private window.
Example:
windows.create({"url": url, "incognito": true});
Check Browser compatibility.
Edit:
Sorry, but above Solution won't work in a web page, as the windows object is not available there. It may only work for browser extensions.
Solution 2:
You could create a desktop shortcut and use the -incognito flag and the web address to get it done, as per the following page:
https://www.tekrevue.com/tip/incognito-mode-shortcut/
This is a bit worse than the "worst case" you outlined, but if you'll be testing the same pages repeatedly, it might not be so bad.
Solution 3:
According to this stackoverflow answer it is impossible
https://stackoverflow.com/a/16148152/6820123
And because you don't want it because of privacy reasons, this is the reason why browsers have no such function. Browsers are made for the masses and there is a bit security and privacy way more important than a insecure function for a very special use case.