Unfortunately, cross-domain security will block this information from you, since your iframe is not in the same domain as the parent page that implements it. You can check the referrer in your iframe, but it will give you the name of the page that implements it.
If you were in the same domain, you would have access to document.referrer in javascript and could get it through an iframe.
I have an idea for a solution.
If you used a script to embed an iframe in the parent page, you could do something like this.
function createIFrame() { var ref = document.referrer; ifrm = document.createElement("iframe"); ifrm.setAttribute("src", "http://www.nba.com/?referrer="+ref); ifrm.style.width = 640+"px"; ifrm.style.height = 480+"px"; document.body.appendChild(ifrm); } createIFrame();
This will allow you in your iframe to read the referrer request line from your URL and send this information to your server. This will require you to pack some javascript with your widgets, but this may be the only solution for you.
JSFiddle - http://jsfiddle.net/7QbPN/
source share