I want to open a new URL in Incognito/ Private window when someone clicks on a particular link.
Is it possible through javascript?
Check below
chrome.windows.create({"url": url, "incognito": true});
Solution won't work in a web page, as the windows object is not available there. It may only work for browser extensions.
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/windows/create#Browser_compatibility
Its like you want to manipulate every browser via javascript. Such functionality may opens a door to be hacked for other dangerous commands.
I think no standard browser will allow to be manipulated like this except with designed extensions can call their API methods after ensuring their filters for dangerous commands.
The best option is to open your website in incognito mode and then use window.open method.
on chrome you can try this:
chrome.windows.create({
url: "http://www.google.com",
incognito: true
});
ref: https://developer.chrome.com/extensions/windows#method-create
You can create a new extension
chrome.windows.create({ url: " http://www.google.com ", incognito: true });
Yes, possible through Javascript, But not sure about the Web page's but this will work well for chrome extensions.
But you can't force a user to open the browser in private browsing mode programmatically.
windows.create({"url": url, "incognito": true})
OR
chrome.windows.create({"url": url, "incognito": true});
Basically windows.create
accepts an optional incognito parameter.
Won't work in case of a web pages, as the windows
object is not available there. It may only work for browser extensions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.