title: Detect X-Frame-Options
body: <p>Is there a way to detect whether or not a page is allowed to load within an iframe?</p>
  
  <p>If a URL can not load within an iframe, I would like to let the user know that the URL they are submitting will not work on our site.</p>
  
  <p>I have tried to get the contents, but that doesn't work:</p>
  
  <pre><code>$("iframe#data-url").on("load", function() {
      alert($(this).contents())
  });
  </code></pre>
  
  <p>I am not really sure where to go from here.</p>
  
  <blockquote>
    <p>Refused to display '<a href="https://www.facebook.com/">https://www.facebook.com/</a>' in a frame because it set 'X-Frame-Options' to 'DENY'.</p>
  </blockquote>
  
  <p>Is there a way to detect <code>X-Frame-Options</code>?</p>