1

I am relatively new to JS so apologies for any basic errors I have made here.

I am attempting to insert some JS on our site that will detect if the user has Flash enabled & the site is able to launch a popup, if these fail the user will be directed to a support page to resolve these.

The code works without issue on Chrome and Firefox, the issue I am having is on IE the popup which launches as a test is not being closed by the script.

Am I missing something glaringly obvious?

    function loadpopunder(){
 var popupBlockerChecker = {
          check: function(popup_window){
              var _scope = this;
              if (popup_window) {
                 if(/chrome/.test(navigator.userAgent.toLowerCase())){
                     setTimeout(function () {
                         _scope._is_popup_blocked(_scope, popup_window);
                      },250);
                 }else{
                     popup_window.onload = function () {
                         _scope._is_popup_blocked(_scope, popup_window);
                     };
                  }
              }else{
                 _scope._displayError();
              }
          },
         _is_popup_blocked: function(scope, popup_window){
              if ((popup_window.outerHeight > 0)===true)
              popup.close();
          },
         _displayError: function(){
              popupFail=true;
          }
 };
       var popup = window.open("http://www.google.com", '_blank', "width=10, height=10, left=1, top=1, scrollbars=no, resizable=no");
   popupBlockerChecker.check(popup);
      } 

loadpopunder() 
freginold
  • 3,946
  • 3
  • 13
  • 28
Luke Brown
  • 35
  • 4
  • There's a couple of answers here that may help: [http://stackoverflow.com/questions/10612321/javascriptwindow-close-doesnt-close-the-tab-in-ie-8](http://stackoverflow.com/questions/10612321/javascriptwindow-close-doesnt-close-the-tab-in-ie-8) – freginold May 19 '17 at 13:05

0 Answers0