/iframe, redirect, window

Check if a page is loaded in an iframe

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.