Dear all..
I want to get the meta description and image in the head section of parent page from the iframe.
In a simple page I did it like this :
This works fine, but when inside an iframe, I want to get the title, location, meta descripton and the image of the parent page using jQuery.
For title and url of the parent page I have used:
its working fine also. but for the meta description and the image i am facing problem.
Any sample code for this please..
Regards,
Mudassir
I want to get the meta description and image in the head section of parent page from the iframe.
In a simple page I did it like this :
Code:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <title></title> <link rel="image_src" href="source to my image" /> <script type="text/javascript"> function addToInterest() { var meta = document.getElementsByTagName("title")[0].innerHTML; meta += "\n"; meta += $('meta[name=description]').attr("content"); meta += "\n"; meta += meta += $(location).attr('href'); meta += "\n"; meta += $('link[rel=image_src]').attr("href"); alert(meta); } </script>
For title and url of the parent page I have used:
Code:
var meta = parent.document.getElementsByTagName("title")[0].innerHTML; meta += document.referrer;
Any sample code for this please..
Regards,
Mudassir
Comment