I want to open new tab using _authTab = window.open('', '_blank');
an set it's url asynchronously
for example setTimeout(() => _authTab!.location.href = 'https://stackoverflow.com/', 2000);
. On chrome everything works fine: blank page is openned and after 2 seconds https://stackoverflow.com/
is loaded.
function setUrlAsync(): AsyncAction {
let _authTab: Window | null;
return async (dispatch, getState, api) => {
try {
let authTab: AuthWindow;
_authTab = window.open('', '_blank'); // A new window has to be be opened synchronously to avoid pop-up blockers (https://stackoverflow.com/questions/2587677/avoid-browser-popup-blockers)
setTimeout(() => _authTab!.location.href = 'https://stackoverflow.com/', 2000);
} catch (error) {
authActions.callbackUrlNotReceived({ error });
throw error;
}
};
}
Ms Edge throws an error causing new tab stays _blank
[object Error]: {description: "Permission denied", message: "Permission denied", nr@seenError: true, number: -2146828218, stack: "Error: Permission denied at Anonymous function (https://52f62d4b.ngrok.io/:149596:15) at nrWrapper (Unknown script code:1:16969)"}
description: "Permission denied"
message: "Permission denied"
nr@seenError: true
number: -2146828218
stack: "Error: Permission denied at Anonymous function (https://52f62d4b.ngrok.io/:149596:15) at nrWrapper (Unknown script code:1:16969)"
__proto__: Error
EDIT
Webpage is being used inside iframe
<iframe
allow="accelerometer *; ambient-light-sensor *; autoplay *; camera *; encrypted-media *; fullscreen *; geolocation *; gyroscope *; magnetometer *; microphone *; midi *; payment *; picture-in-picture *; speaker *; usb *; vibrate *; vr *"
sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"
src="....">
</iframe>