Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the parent window URL from Iframe?

I know it's a security issue. But is there any way in HTML5. Cause I seen the below code opens a window with the parents URL in tweet box

<iframe src="https://platform.twitter.com/widgets/tweet_button.html"
        style="border: 0; width:130px; height:20px;"></iframe>
like image 899
user2736812 Avatar asked Mar 20 '14 03:03

user2736812


1 Answers

Try this inside the iframe. It will alert the parent window's location URL.

alert(document.referrer);
like image 88
SajithNair Avatar answered Sep 22 '22 17:09

SajithNair