I am trying to open a new session with a different URL in an incognito window once someone clicks on a button in a normal window browser.
My button code is this:
<button onclick=($('#myForm').submit())>Start new session</button>
My Form is created through JS as given here:
let myForm = document.createElement("FORM")
myForm.setAttribute('action', 'https://stackoverflow.com/${PassingsomeParameters}/')
myForm.setAttribute('method', 'POST');
myForm.setAttribute('id', 'myForm');
let myFormFields = document.createElement("INPUT");
myForm.setAttribute('name', 'MyToken');
myForm.setAttribute('value', info.headers['SessionToken']);
myForm.appendChild(myFormFields);
$('body').append(myForm);
I am running these codes through a browser extension and it works fine. I would like to open an incognito window with a new session instead so that I can keep the current normal window session active too.
PS the form has the tokens and other information to login directly to the other page and hence I am using a form here.
Thanks!