I want to show message if popup are blocked in the browser and dont want to open video. I am showing video in window.open() and if popup are blocked in browser then i want to show message that "popup are blocked, please enable them to see video" Below is my code in react which is not working , it is still showing video when popup are blocked in browser.
openRaceReplay(e = { stopPropagation() { } }, data){
e.preventDefault();
let popupOptions = createIframeUrl();
this.setState(
{
replayError: ""
},
() => {
if(data.flashReplayUrl){
if (isAndroid() || isIos()) {
window.open(data.flashReplayUrl, TARGET_WINDOW.SELF);
} else {
const windowHandle = window.open(data.flashReplayUrl,TARGET_WINDOW.BLANK,popupOptions);
//It is still opening video
if(!windowHandle || windowHandle.closed || typeof windowHandle.closed == 'undefined') {
this.setState({
replayError: MESSAGES.ENABLE_POPUP_MESSAGE
});
}
}
}
else {
this.setState({
replayError: MESSAGES.RACE_RACEREPLAY_NOT_AVAILABLE
});
}
}
);
}