Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

Maybe you don’t want a bunch of cached data hanging around after your browser session exits. Maybe you travel a lot with your laptop and don’t want a bunch of private information on a machine that might be stolen. Maybe you do a lot of “birthday shopping.”

Whatever the reason, if you prefer to use Chrome in incognito mode for most of your day to day browsing, Michael T. Bee sent us a convenient script that starts up Chrome in incognito mode automatically. Here it is in all it’s glory:

//Chrome_Incognito.js – start new chrome incognito(sort of)

var liWait=175; //wait ms (double on older pc)

var oSh=new ActiveXObject(“WScript.Shell”);
oSh.Run(“chrome.exe”); //start chrome
WScript.Sleep(liWait);
oSh.Sendkeys(“^+N”); //start new incognito window
WScript.Sleep(liWait);
oSh.Sendkeys(“%{Tab}”); //go previous(first) browser window
WScript.Sleep(liWait);
oSh.Sendkeys(“%{F4}”); //close first browser window

Just drop this in notepad and save it as chrome_incognito.js on your desktop. When you double click it, it will launch Chrome, make an incognito window, and then close the first window. It does all this by sending artificial keypress events to the application through the Shell ActiveX object, a technique which might come in handy for scripting other standard Windows applications.

If you have an older or slower machine, you might need to adjust the liWait variable to give your machine time to launch Chrome before the application starts sending fake keypresses to it.

Going Incognito At Startup


Related
blog comments powered by Disqus