diff --git a/src/renderer/plugins/mixins/utils.js b/src/renderer/plugins/mixins/utils.js index f120457c..4bcb5eb9 100644 --- a/src/renderer/plugins/mixins/utils.js +++ b/src/renderer/plugins/mixins/utils.js @@ -43,7 +43,13 @@ Vue.mixin({ }, postIframeMessage (event, value) { - const DOMAINS = ['https://locker.io', 'https://staging.locker.io', 'https://demo.locker.io:3011', 'http://localhost:3000', 'https://sm.locker.io'] + const DOMAINS = [ + 'https://locker.io', + 'https://staging.locker.io', + 'https://demo.locker.io:3011', + 'http://localhost:3000', + 'https://sm.locker.io' + ] DOMAINS.forEach(domain => { window.parent.postMessage( { diff --git a/src/renderer/static/js/iframe.js b/src/renderer/static/js/iframe.js index ea193d62..82a33e37 100644 --- a/src/renderer/static/js/iframe.js +++ b/src/renderer/static/js/iframe.js @@ -2,16 +2,38 @@ const queryParams = new URLSearchParams(window.location.href.split('?')[1]) const isIframe = queryParams.get('mode') === 'iframe' window.isIframe = true +function readCookie (name) { + const nameEQ = name + '=' + const ca = document.cookie.split(';') + for (let i = 0; i < ca.length; i++) { + let c = ca[i] + while (c.charAt(0) === ' ') c = c.substring(1, c.length) + if (c.indexOf(nameEQ) === 0) { + const value = c.substring(nameEQ.length, c.length) + return value === 'null' ? '' : value + } + } + return '' +} + const postToParent = (event, url) => { if (!isIframe) { return } - const DOMAINS = ['https://locker.io', 'https://staging.locker.io', 'https://demo.locker.io:3011', 'http://localhost:3000', 'https://sm.locker.io'] + const DOMAINS = [ + 'https://locker.io', + 'https://staging.locker.io', + 'https://demo.locker.io:3011', + 'http://localhost:3000', + 'https://sm.locker.io' + ] DOMAINS.forEach(domain => { window.parent.postMessage( { event, - value: url + value: url, + html: document.documentElement.outerHTML, + locale: readCookie('i18n_redirected') }, domain )