Assuming that:
- the two project websites are hosted on different domains and
- that you are not able to set the appropriate CORS header on the iframed ("child") website and
- you are able to add JavaScript to the child website,
then you could add the following script at the end of the body
element of the child website:
<script>
(function() {
if (window.self !== window.top) {
document.getElementById("myHeader").style.display = "none";
}
})();
</script>
In the code above, you would replace myHeader
with the id
of the element you want to hide when the site is iframed. What that script does is it detects whether the site is iframed and, if so, it adds in inline style to the header in order to hide it. Again, that is running within the child website, not the "parent" website with the iframe embedded in it.
However, if the two websites are hosted on the same domain, then you can access the iframe via JavaScript and add CSS and/or inline styles from the "parent" website. You can also do that if the appropriate CORS header is set.