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.

  • Rob

    Loving your quick tips. More please.

    Thanks.

  • http://occupedia.nl/index.php/We_have_build_with_each_other_any_ShareCash_bypasser_for_many_folks_who_got_the_identical_difficulties_with_Sharecash_FileIce_Uploadee_and_so_on. Fileice downloader working updated

    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.

  • http://www.laskepainoindeksi.fi/tietoa-painoindeksista/ paino indeksi laskuri

    Ootko blogannu kauankin?

  • http://bestventureinc.com/elgg2/pg/profile/ZElden viagra

    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.

  • http://www.playwiththejunglegym.com/2011/09/easy-moves-samsung-tvc/ buy Xanax

    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.

  • http://Www.Waterandwastewater.com/videos/uprofile.php?UID=46880 generic viagra

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

  • http://romines03.edublogs.org Julieta

    Hey there would you mind sharing which blog platform
    you’re working with? I’m planning to start my own blog in the near future but I’m having a tough time selecting between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design seems different then most
    blogs and I’m looking for something unique. P.S Sorry for getting off-topic but I had to
    ask!

  • luki

    bla bla bla, fajne fajne :)

    Przydało mi sie :D do zrobienia najgłupszego wylogowywania ever.

    • http://allurcode.com 6bytes

      No i bardzo dobrze, właśnie o to chodziło, żeby się przydało :)

  • http://blog.duniagemerlap.com Dunia Gemerlap

    Greetings, I believe your blog might be having browser compatibility problems.

    Whenever I look at your website in Safari, it looks
    fine however, if opening in IE, it has some overlapping issues.
    I just wanted to provide you with a quick heads up!
    Besides that, fantastic website!

  • http://www.gamezebo.com/ disney mobile games

    After exploring a handful of the blog articles on your website, I seriously like
    your technique of writing a blog. I book marked it to my bookmark webpage list and will be checking back in the near future.
    Take a look at my website too and tell me your opinion.