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?
Asked
Active
Viewed 1,891 times
0
-
Can you fix your question? All the "a"s are confusing me. – Dom Mar 12 '13 at 18:36
-
You are not explaining this clearly. "Show" = copy? – Diodeus - James MacFarlane Mar 12 '13 at 18:37
-
1Possible duplicate of http://stackoverflow.com/questions/8287933/is-it-possible-to-display-only-a-certain-div-within-an-iframe – CoffeeRain Mar 12 '13 at 18:41
1 Answers
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