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 ...
I've heard window.top doesn't always work, for example when the IFrame and the page in which it's embedded aren't from the same origin, in such a case you have to do error handling and all that, so it would be easier if there was a reliable function ...