I want to be able to easily and reliably check if a javascript is run inside an iframe, a bit like:
"
function onlyRunWhenImInsideIframe() {
insideIframe = document.checkIfInsideIframe();
console.log(insideIframe); // should return true or false
if (insideIframe) { /* run other code */ }
}
"
I think it would be much easier with such a function to make a site a combined site, so if it's loaded directly it displays fully but if it's loaded inside an iframe it shows the embed version.