1

I have an issue which I have seen a variety of questions on but have been unable to solve. In my website I have a home page, which has a button, a label, and some script.


<html>
<body onFocus="parent_disable();" onclick="parent_disable();">
    <button type="button" onclick="openPopup();">Select a body area</button>
    <h2 id="problem">None currently</h3>
</body>
</html>
<script>
var popupWindow;
function openPopup() {
    popupWindow = window.open('problemSelectionPopup.html', '', 'width:' + window.width + ',height:' + window.height);
    popupWindow.focus();
}

function retrieveFormData(data) {
    document.getElementById("problem").value = data;
}
</script>

I have a popup window as well, with a few different elements on it. The idea is that the user should be able to select an item in the popup, and then call retrieveFormData(data), to change the label text. I was trying to use window.opener like this:

function passPopupData() {
    window.opener.retrieveFormData("data");
    window.close();
}

however the window.opener.... line gave me this error in google chrome:

Uncaught SecurityError: Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.

Does anyone know how to A) fix the error or B) Pass data from a popup to it's parent? Either would be acceptable.

perennial_
  • 1,798
  • 2
  • 26
  • 41

0 Answers0