title: How to prevent an iframe page from being accessed directly
body: <p>Continuing with my previous question on calling iframes via jscript.. I would like to implement a security feature so that anyone who access the iframe directly is redirected to a specific page.</p>
  
  <p>One of the other questions asked this but was a bit more general. The code mentioned there was:</p>
  
  <pre><code>if(window.top.location == window.location){
    window.location = "http://example.com/whatever/page/you/want/them/to/go/to.html";
  }
  </code></pre>
  
  <p>Question: Would it suffice to tag this between the  and place it on my page.htm which is the one being called via the iframe?</p>