I need to get the origin of an iframe. Until now the code we used created an anchor element and read it's origin, but this attribute is not available in Internet Explorer. What is the most elegant way to get the origin from an iframe object?
Here is the old code:
function getOrigin(href) {
var l = document.createElement("a");
l.href = href;
return l.origin;
};
var x = document.getElementById("my-iframe");
alert(getOrigin(x.src));
But as i said the origin attribute is not supported in Internet Explorer.
I need to support Internet Explorer 10 and up.