Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
153
rated 0 times [  160] [ 7]  / answers: 1 / hits: 21934  / 7 Years ago, wed, august 23, 2017, 12:00:00

I am having simple issue regarding the iframe, I want to strip the header and footer from the source in the iframe, I tried clipping and pointing to the content but it is not working you have any thoughts?



My code is :



<div style=height:1500px;>
<iframe src=url/#content name=iframe_all scrolling=no
frameborder=0 height=100% width=100% ></iframe>
</div>


where #content is the content in the source. It works fine one the first page of source but when the user clicks on the second page of the source in iframe again the header appears.


More From » html

 Answers
18

You can access the content of the iframe with javascript:



var frame = document.querySelector(iframe);
header = frame.contentDocument.querySelector(header);
header.remove();
footer = frame.contentDocument.querySelector(footer);
footer.remove();


Or adapt the selectors for the elements you need.


[#56670] Monday, August 21, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
malkajillc

Total Points: 652
Total Questions: 107
Total Answers: 98

Location: Finland
Member since Sat, Nov 6, 2021
3 Years ago
;