I have a popup that allows the opening window to optionally define a callback function that, if defined, will be called when the user executes the popup. Based on the tips I read, I do this:
if (window.opener && (typeof window.opener.callbackFunction == 'function')) { window.opener.callbackFunction() }
This works great in Firefox - when a function is defined, typeof is a "function" as intended. However, in IE8, typeof is an "object." A function is usually defined in an opener, for example:
function callbackFunction() { ... }
Does anyone know why typeof will be different in IE8? I am also open to other suggestions on how to do this. I also tried if (window.opener && window.opener.callbackFunction) , but this caused IE8 to explode when the function was not defined.
source share