Skip to content Skip to sidebar Skip to footer

On Ie 10+, Will Document.referrer Be Blank When Read Inside An Iframe?

On all other recent browsers, reading document.referrer from an app which runs inside an iframe would return the URL of the parent site. On IE 11, however, it seems to be returning

Solution 1:

I've discovered that the document.referrer property is also an empty string when an iframe has no src or a has a javascript: protocol for its src.

You can verify this quite easily in the developer tools:

var ifr = document.createElement('iframe');
document.body.appendChild(ifr);
ifr.contentDocument.referrer;
//-> '' in IE, '<parent location>' in Chrome

Post a Comment for "On Ie 10+, Will Document.referrer Be Blank When Read Inside An Iframe?"