Dois
Dois

Reputation: 401

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

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).

Upvotes: 39

Views: 45151

Answers (2)

eggyal
eggyal

Reputation: 125835

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).

Upvotes: 34

TheIrishPizzaGuy
TheIrishPizzaGuy

Reputation: 21

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

Upvotes: -1

Related Questions