0

I have a trying a to show a a div element from one page into another using iframe. IS it possible? I can probably get the entire page but what if want just a specific part of the page?

soum
  • 1,131
  • 3
  • 20
  • 47

1 Answers1

1

You can try using anchors. On the parent page, add an ID to the div if you haven't done so already. Then, in the iframe, set the src to 'http://yoursi.te/#div-id' where div-id is the ID of the `div.

This makes it so that the iframe automatically scrolls down to the div instead of starting from the top.



Other than that, you can try dynamically removing elements from the DOM using JavaScript when a URL parameter is set (the iframe points to 'http://yoursi.te/?only-div=true').

Then on the parent site, get the query using JavaSciript and remove all other elements except for the div if the parameter returns 'true'.

Community
  • 1
  • 1
Alfred Xing
  • 4,406
  • 2
  • 23
  • 34