Lampe2020
Making moves
Options
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
โ05-05-2022
04:35 AM
Status:
New idea
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.
4 Comments