Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Good Morning,

I am in need of assistance, I am not a programmer and I am venturing to create a website for my company, I am having a lot of difficulty in the following question:

  • I need to incorporate a news page, but I only need the news fields, that is, if I import with the iframe it brings the entire page with a header and footer, I need to bring the page without a header and footer, for that I need remove or hide some divs in the iframe, when I try to do that I can't because of the security error.

Does anyone have any solution to solve this problem?

Thank you in advance!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

I don't know your code, so i can't know, what that security error is...

You can use javascript to remove elements in iframe, and this shouldn't throw any error...

content of html with iframe...

<script>
   let newsIframe = document.getElementById("newspage");
   let newsHeader = iframe.contentWindow.document.getElementById("header");
   newsHeader.style.display = "none"; 
   let newsFooter = iframe.contentWindow.document.getElementById("footer");
   newsFooter.style.display = "none"; 
</script>

more content...

That script tag with code must be after your <iframe>


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...