FIX: Make embeddable discourse more forgiving with https

This commit is contained in:
Robin Ward 2016-04-26 15:03:44 -04:00
parent 905068cf23
commit 7a01d575c2
No known key found for this signature in database
GPG Key ID: 0E091E2B4ED1B83D

View File

@ -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) {