Check if a page is loaded in an iframe

Posted by 6bytes at 30 June 2011

Category: JavaScript

Tags: , ,

Just a quick tip, how to check if current page has been loaded in an iframe or was it accessed directly.

if (window.self === window.top) {
    // we're NOT in an iframe
} else {
    // we're in an iframe
}

That’s it.

6 Comments

  1. Rob says

    Loving your quick tips. More please.

    Thanks.

    Reply
  2. Fileice downloader working updated says

    You can definitely see your enthusiasm in the article you write.
    The sector hopes for more passionate writers like you who aren’t afraid to say how they believe. At all times follow your heart.

    Reply
  3. paino indeksi laskuri says

    Ootko blogannu kauankin?

    Reply
  4. viagra says

    Your current article provides established necessary
    to us. It’s extremely useful and you are certainly very educated in this region.
    You possess opened my eyes for you to varying opinion of this kind
    of subject using intriquing, notable and reliable content material.

    Reply
  5. buy Xanax says

    Your article offers established useful to myself.
    It’s quite informative and you’re certainly quite knowledgeable in this area. You get opened up my personal face for you to numerous thoughts about this kind of topic with intriquing, notable and solid content.

    Reply
  6. generic viagra says

    I visited several web sites however the audio feature for
    audio songs present at this website is genuinely superb.

    Reply

Leave a Reply

Leave a Reply
  • (required)
  • (required) (will not be published)