2

This is basically the opposite of this question - CSS override body style for content in iframe?

I have a CMS that provides data to a vendor CMS that is actually housed on the same server/domain.

The CMS is also used as a stand-alone. So what we want to do is strip all of our headers, menus, and footers when displayed in the LMS.

So is there CSS I can use on my side that will only be used when the site is in an iframe?

Community
  • 1
  • 1
blankip
  • 340
  • 5
  • 18

1 Answers1

0

I believe you have to use javascript. Taken from How to identify if a webpage is being loaded inside an iframe or directly into the browser window?

function inIframe () {
    try {
        return window.self !== window.top;
    } catch (e) {
        return true;
    }
}
if(inIframe()){
    // Change css
}