From 7a01d575c25871a4f593d40a964776398ec9ac7b Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 26 Apr 2016 15:03:44 -0400 Subject: [PATCH] FIX: Make embeddable discourse more forgiving with https --- public/javascripts/embed.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/javascripts/embed.js b/public/javascripts/embed.js index 33c11d337a4..4412a33c117 100644 --- a/public/javascripts/embed.js +++ b/public/javascripts/embed.js @@ -63,9 +63,13 @@ return top; } + function normalizeUrl(url) { + return url.replace(/^https?(\:\/\/)?/, ''); + } + function postMessageReceived(e) { if (!e) { return; } - if (DE.discourseUrl.indexOf(e.origin) === -1) { return; } + if (normalizeUrl(DE.discourseUrl).indexOf(normalizeUrl(e.origin)) === -1) { return; } if (e.data) { if (e.data.type === 'discourse-resize' && e.data.height) {