0

I am trying to do new functionality. I was able to achieve what I want in modern browsers but not in the IE11.

  if (!window.IS_PRESENTING) {
      childWindow = window.open(window.location.pathname);
      childWindow.IS_PRESENTING = true;
      setupMainWindow();
    } else {
      setupChildWindow();
    }

In modern browsers IS_PRESENTING is being set on the child windows. But in the IE11 it doesnt work and the browser keeps opening new windows...

How can I fix this? Any suggestions?

LuckyLuke
  • 1,028
  • 2
  • 14
  • 28

1 Answers1

1

I can reproduce the issue in IE 11. As a workaround, in IE 11, you can get the value of window.IS_PRESENTING in the opening window and set the opening window's IS_PRESENTING value according to it :

In the opening window:

targetWindow = window.opener;
var IS_PRESENTING = !targetWindow.IS_PRESENTING;  //targetWindow.IS_PRESENTING can get the value of window.IS_PRESENTING in child window
alert("The value of IS_PRESENTING is " + IS_PRESENTING);

Reference link: Window.opener

Yu Zhou
  • 11,532
  • 1
  • 8
  • 22
  • Thanks, actually I came up with other solution. When creating window I have set the name for a window. Then I can check if the window name is equal to: if (window.name !== nameForOpenedWindow) { openedWindow = window.open(window.location.pathname, nameForOpenedWindow); Then I can check if this is the window I need by checking the name of the actual window. – LuckyLuke Jan 08 '21 at 10:00