Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A first solution is to use <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options" rel="nofollow"><code>X-Frame-Options</code></a> header to prevent loading your page to an iframe. <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options" rel="nofollow"><code>X-Frame-Options</code></a> can specify one of two values: <strong><code>SAMEORIGIN</code></strong>, which only allows iframes from the same origin to display this content, and <code>deny</code>, which prevents any iframe from doing so. BUT this header is not part of HTTP specification and was introduced by Microsoft, so not all browsers support this header. An example of <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options" rel="nofollow"><code>X-Frame-Options</code></a>:</p> <pre><code>X-Frame-Options: SAMEORIGIN </code></pre> <p>In case some old browsers don't support the <code>X-Frame-Options</code> header. You could try a technique called <a href="http://en.wikipedia.org/wiki/Framekiller" rel="nofollow">FrameKiller</a>. There are limitations, though, as pointed out in that link.</p> <blockquote> <p>The user agent does not support JavaScript.</p> <p>The user agent supports JavaScript but the user has turned support off.</p> <p>The user agent's JavaScript support is flawed or partially implemented.</p> </blockquote> <p>The idea is to use javascript to detect whether your page is loaded into an iframe. There are many ways to implement a frame killer script.</p> <p>For your requirement, you could implement a frame killer script like this: try to access your parent window to read the <code>window.location</code>. If they include your page inside their iframe, the code would throw exception (cross-domain)</p> <p>Example code:</p> <pre><code>window.onload = function(){ try { if (window.parent &amp;&amp; window.parent.location.hostname !== "www.abc.com"){ throw new Error(); } } catch (e){ alert("Please visit www.abc.com to play this game."); //You could do whatever you want here } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload