Problem with Firefox AddEventListener

I have a web application consisting of two websites, one of which runs on port 8080 (Java), and the other on port 80 (IIS). Java web pages are called to IIS web pages, which are sometimes returned to Java web pages to obtain additional information. JavaScript that handles data exchange / data exchange works in IE , but not in Firefox.

Page 1 (IIS)> onClick of Button> Page 2 (Java / Tomcat)> User closes pop-up window> Transfer data to page 1

Javascript

if(window.attachEvent){//IE exclusive method for binding an event
    alert("AttachEvent");
    window.attachEvent("onfocus", Focus_onfocusEvent); 
    window.objExitPopupWindow.attachEvent("onunload", Focus_onunloadExitEvent);
} else if(window.addEventListener){//DOM method for binding an event. W3C standard          
    try{
        alert("Event Listener");
        window.addEventListener("focus", Focus_onfocusEvent, true);
        window.objExitPopupWindow.addEventListener("unload", Focus_onunloadExitEvent, true);
    } catch(err) {
            alert(err);
    }   
}   

The problem I am facing:

a) In Firefox, if I have it turned on alert("Event Listener");, I get an error message Error: Permission denied for "http://localhost" to get property Window.addEventListener from "http://localhost:8080".

b) Firefox, , , , Focus_onuloadExitEvent , Focus_onfocusEvent, . Focus_onunloadExitEvent.

, Firefox, IE - .. , onfocusEvent onunloadEvent, .

+3
1

. JavaScript . , B. - localhost:80, - localhost:8080, .

, , , iframe , . , JavaScript .

+5

Source: https://habr.com/ru/post/1725758/


All Articles