title: Check if parent window is iframe or not
body: <p>How can I tell from a page within an iframe, if the parent itself is also within an iframe?</p>
  
  <p><strong><em>Explanation:</em></strong></p>
  
  <p>My home page <code>home.html</code> contains an iframe</p>
  
  <pre><code>&lt;iframe src="sample.html"&gt;&lt;/iframe&gt;
  </code></pre>
  
  <p>I need to detect if <code>home.html</code> (ie: parent of <code>sample.html</code>) is within an iframe.</p>
  
  <p>Code in <code>sample.html</code>:</p>
  
  <pre><code>if(self==window)
  {
      alert('home.html is not in iframe');
  }
  else
  {
      alert('home.html is in iframe');
  }
  </code></pre>
  
  <p>My question is not a duplicate. It's a different case.</p>