Sometimes legacy Dojo interfaces may need to adjust their
behavior if they're embedded in the web staff client. This patch
adds a new utility function, openils.Util.inIFrame(), to detect
if such code is running in an iframe. If so, the presumption
is that iframe belongs to the web staff client.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
);
};
+ /**
+ * Check to see if we're running in an iframe; if we
+ * are, we assume that the iframe is specifically one
+ * used by the web staff client to embed legacy interfaces.
+ */
+ openils.Util.inIframe = function() {
+ /* http://stackoverflow.com/a/326076 */
+ try {
+ return window.self !== window.top;
+ } catch (e) {
+ return true;
+ }
+ };
+
}