diff --git a/dist/extra/IFrameAPI.js b/dist/extra/IFrameAPI.js index 19f169b2b..0dba2598d 100644 --- a/dist/extra/IFrameAPI.js +++ b/dist/extra/IFrameAPI.js @@ -14,6 +14,8 @@ ol.ext.IFrameAPI = function(targetOrigin) { this.setter = {}; // Listener api this.listener = {}; + // Nothing to do there + if (window.parent === window) return; // Wait for target ready window.addEventListener('message', function(e) { if (e.data.listener) { diff --git a/dist/extra/MapIFrameAPI.js b/dist/extra/MapIFrameAPI.js index 90e49a846..8f89572eb 100644 --- a/dist/extra/MapIFrameAPI.js +++ b/dist/extra/MapIFrameAPI.js @@ -58,7 +58,7 @@ var MapIFrameAPI = function(win, id, targetOrigin) { * @param {Object|function} data argments or a callback function to get returned Transferable * @param {function} fn callback function to get returned Transferable */ - MapIFrameAPI.prototype.call = function(key, data, fn) { +MapIFrameAPI.prototype.call = function(key, data, fn) { if (typeof(data)==='function') { fn = data; data = undefined; @@ -91,7 +91,7 @@ var MapIFrameAPI = function(win, id, targetOrigin) { * @param {function} fn callback function * @return {function} IFrameListener */ - MapIFrameAPI.prototype.addIFrameListener = function(key, fn, data) { +MapIFrameAPI.prototype.addIFrameListener = function(key, fn, data) { var callback = function(e) { if (e.data.id === this.id && e.data.api === key) { fn.call(this, e.data.data); diff --git a/src/utils/IFrameAPI.js b/src/utils/IFrameAPI.js index 6292a43bd..82a9f853d 100644 --- a/src/utils/IFrameAPI.js +++ b/src/utils/IFrameAPI.js @@ -15,6 +15,8 @@ var ol_ext_IFrameAPI = function(targetOrigin) { this.setter = {}; // Listener api this.listener = {}; + // Nothing to do there + if (window.parent === window) return; // Wait for target ready window.addEventListener('message', function(e) { if (e.data.listener) { diff --git a/src/utils/MapIFrameAPI.js b/src/utils/MapIFrameAPI.js index 6237aa142..d4341020b 100644 --- a/src/utils/MapIFrameAPI.js +++ b/src/utils/MapIFrameAPI.js @@ -59,7 +59,7 @@ var MapIFrameAPI = function(win, id, targetOrigin) { * @param {Object|function} data argments or a callback function to get returned Transferable * @param {function} fn callback function to get returned Transferable */ - MapIFrameAPI.prototype.call = function(key, data, fn) { +MapIFrameAPI.prototype.call = function(key, data, fn) { if (typeof(data)==='function') { fn = data; data = undefined; @@ -93,7 +93,7 @@ var MapIFrameAPI = function(win, id, targetOrigin) { * @param {function} fn callback function * @return {function} IFrameListener */ - MapIFrameAPI.prototype.addIFrameListener = function(key, fn, data) { +MapIFrameAPI.prototype.addIFrameListener = function(key, fn, data) { var callback = function(e) { if (e.data.id === this.id && e.data.api === key) { fn.call(this, e.data.data);