How to open new incognito window with Javascript? (Google Chrome)
Asked Answered
B

2

39

I want to help my friend open a website in a new incognito window when he performs some mouse gestures (custom stroke in Mouse Stroke - Chrome Extension).

Blooper answered 9/2, 2010 at 9:52 Comment(4)
mouse stroke eh.Ury
you say friend, eh?Glower
This is a good question - not for the porn, but for the ability to have two separate sessions on the same website.Sombrero
Google lead me here - I was looking for a way to open Facebook/Twitter in incognito windows from a bookmarklet for privacy. Would appreciate any ideas.Millisecond
H
34

Chrome extensions with the tabs permission can use the chrome.windows.create method:

chrome.windows.create({"url": url, "incognito": true});

However, to access it, you'll either need to write your own extension or find an existing one which provides a suitable hook (I don't know whether this can be done with "Mouse Stroke"—I'm too scared to look).

Hibbert answered 13/10, 2011 at 17:46 Comment(4)
can you recommend a simple chrome extension?Nub
@CarlosPliego: it's just HTML and Javascript—write one yourself? developer.chrome.com/extensionsHibbert
I dare say this is outdated. In the console it looks like the windows object doesn't exist anymore.Cynewulf
Can you provide an example for what the manifest.json would look like?Erdrich
K
-1

windows.create still works for me given I use it from the background script.

Karinekariotta answered 11/2, 2021 at 8:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.