In Non-IE browser, window.opener.document.getElementById is returing null
On the OOTB button, we have a JS that uses window.open to point to an external URL. After using window.open, we are trying to refresh the parent window for which we are retrieving the element of the parent window using window.opener.document.getElementById(id'). However, in FF/Chrome, this is returning "null". Using 6.3 SP1
var reloadElement = window.opener.document.getElementById("RefreshAfterPrint");
alert(reloadElement); ------- This is returning null in FF/Chrome only. IE returns the object.
window.opener.pega.u.d.reloadSection(reloadElement, "", "", false, true, "-1", false);
***Turned off future commenting per Original Poster's Request***
Since you're using the _self option, the window is going to replace the current page with the supplied URL.
After that, the parent reference is gone. At least that is my understanding, and also my results when testing the same code.
The behavior is consistent across all browsers for me. At least the end behavior is.
For the same code in IE, window.opener is undefined.
But in Chrome the "opener" is considered the current page since it has been replaced. But since it considers the current page as the opener, there will be no reference to the "parent" element you are seeking.
So in either case the reference to the element "RefreshAfterPrint" is null for me either way. For different reasons yes, but ultimately the same.
So, I'm honestly not even sure how your code works even on IE to be honest. It does not for me.