Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: Support referrerPolicy on embed iframe

Gina Haeussgef0fc38418cd3
diff --git a/public/javascripts/embed.js b/public/javascripts/embed.js
index 024dacb61ec..3d2f9838b55 100644
--- a/public/javascripts/embed.js
+++ b/public/javascripts/embed.js
@@ -4,7 +4,7 @@
var comments = document.getElementById('discourse-comments');
var iframe = document.createElement('iframe');
- ['discourseUrl', 'discourseEmbedUrl', 'discourseUserName'].forEach(function(i) {
+ ['discourseUrl', 'discourseEmbedUrl', 'discourseUserName', 'discourseReferrerPolicy'].forEach(function(i) {
if (window[i]) { DE[i] = DE[i] || window[i]; }
});
@@ -44,6 +44,10 @@
iframe.width = "100%";
iframe.frameBorder = "0";
iframe.scrolling = "no";
+ if (DE.discourseReferrerPolicy) {
+ // See https://www.w3.org/TR/html5/semantics-embedded-content.html#the-iframe-element
+ iframe.referrerPolicy = DE.discourseReferrerPolicy;
+ }
comments.appendChild(iframe);
// Thanks http://amendsoft-javascript.blogspot.ca/2010/04/find-x-and-y-coordinate-of-html-control.html