Home > Enterprise >  How can we open Incognito mode in React js.?
How can we open Incognito mode in React js.?

Time:01-03

i want to open my new link in Incognito mode.

i tried :

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

CodePudding user response:

To open a URL in an incognito window in a React app, you can use the window.open method and set the incognito property to true. Here's an example of how you can do this:

function openUrlInIncognito(url) {
  window.open(url, '_blank', 'incognito=yes');
}

You can then use this function to open a URL in an incognito window when a button is clicked or some other event is triggered in your app. For example:

<button onClick={() => openUrlInIncognito('https://www.example.com')}>
  Open URL in Incognito
</button>

Keep in mind that this will only work if the user has a browser that supports incognito mode and has not disabled it.

  • Related