skip to Main Content

How to block website from loading in iframe

How To Block Website From Loading In Iframe

To check if your web page is blocked from loading in iframe, If you use googel chrome, go to development tool and you can view the X-Frame-Options in Header as like below image:


There are three possible values for X-Frame-Options:

DENY – The page cannot be displayed in a frame, regardless of the site attempting to do so.

SAMEORIGIN – The page can only be displayed in a frame on the same origin as the page itself.

ALLOW-FROM uri – The page can only be displayed in a frame on the specified origin.

The x-frame-options header can be implement through .htaccess web server configuration settings.

Header set X-Frame-Options DENY

If your browser doesn’t support it, you can use HTTP Header Field X-Frame-Options:

  <meta http-equiv="X-Frame-Options" content="deny">

After you set it to deny, when you run your web page in the iframe you will get the error like below screenshot:


This Post Has One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top