Template: WhatLinksHere: Difference between revisions
From ASDSO Dam Safety Toolbox
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
scrolling="no" | scrolling="no" | ||
title="What Links Here"></iframe> | title="What Links Here"></iframe> | ||
<script> | <script> | ||
document.querySelector("iframe").addEventListener( "load", function(e) { | document.querySelector("iframe").addEventListener( "load", function(e) { | ||
var iframeWin = document.getElementById("iframeWin"); | |||
var content = (iframeWin.contentWindow || iframeWin.contentDocument); | |||
if (content.document)content = content.document; | |||
// Adjust padding/margin | |||
iframeWin.contentWindow.document.getElementById('maincontentwrapper').style.marginLeft = "0px"; | |||
iframeWin.contentWindow.document.getElementById('maincontentwrapper').style.paddingLeft = "0px"; | |||
// Hide header, heading, back link & footer | |||
content.body.getElementsByTagName("header")[0].style.display = "none"; | |||
content.body.getElementsByClassName("firstHeading")[0].style.display = "none"; | |||
iframeWin.contentWindow.document.getElementById('contentSub').style.display = "none"; | |||
content.body.getElementsByTagName("footer")[0].style.display = "none"; | |||
// Show iframe | |||
iframeWin.style.display="block"; | |||
}); | }); | ||
window.addEventListener("message", receiveMessage, false); | |||
function receiveMessage(event) { | |||
if (event.data && event.data.params && event.data.params.height) { | |||
document.getElementById("iframeWin").style.height = event.data.params.height; | |||
} | |||
} | |||
</script> | </script> | ||
</html> | </html> |
Revision as of 13:20, 7 July 2023
Usage