I am showing the url in iframe, now I want to get the content of the webpage opened in the iframe, Can anyone help me with the same. Thanks in Advance
Asked
Active
Viewed 49 times
-2
-
2Possible duplicate of [Get HTML inside iframe using jQuery](https://stackoverflow.com/questions/16103407/get-html-inside-iframe-using-jquery) – H77 Jun 11 '18 at 07:04
-
Possible duplicate of [How to get the body's content of an iframe in Javascript?](https://stackoverflow.com/questions/926916/how-to-get-the-bodys-content-of-an-iframe-in-javascript) – Søren D. Ptæus Jun 11 '18 at 07:20
2 Answers
1
If you want the DOM object for manipulation
var nestedObject = $(document.getElementById("iframe").contentWindow.document);
If you just want the text
document.getElementById('iframe').contentWindow.document.body.innerHTML

NitinSingh
- 2,029
- 1
- 15
- 33
-1
Get the src attribute of the iframe.
var link = document.getElementById("yourIFrame").src;

bear157
- 1
- 2