Joshua Sera
Joshua Sera

Reputation: 21

How do I find out if a script is running in an iframe

Basically, I just want something not to run when a page is loaded into an iframe. Is there an easy way to do this?

Upvotes: 2

Views: 110

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039508

if (window != window.top) { 
    // the script runs in an iframe
}

Upvotes: 3

Related Questions