Skip to main content

How to Allow Your Web Page to Show in an iframe

If you are not sure if your page can be displayed in an iframe, use our iframe tester to check it out.

The reason that your page/widget does not display in an iframe is most likely due to the x-frame-options header being sent to the browser. All modern browsers adhere to this header for security purposes. You do not want to override this setting for your entire site, but you need to for your widget. You should place your widget's page and code in a sub-folder on your site and then change the settings of that sub-folder to allow for it to be displayed in an iframe.

More information about x-frame-options can be found on the MDN website.

Allow iframes in sub-folder for sites hosted in Apache

Place the code below in a file named .htaccess and place that in the sub-folder with your widget code. PLEASE NOTE. If there is already a .htaccess file in the folder, you do not want to delete the existing file but instead edit it and add the line below.


Header unset X-Frame-Options

I have also seen it shown as below (adds the word always before unset). If the above does not work, try this version


Header always unset X-Frame-Options

Allow iframes in sub-folder for sites hosted in IIS

Place the code below in a file named web.config and place that in the sub-folder with your widget code. PLEASE NOTE. If there is already a web.config file in the folder, you do not want to delete the existing file but instead edit it and place the part that contains the customHeader node in the example below.


<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <remove name="X-Frame-Options" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
</configuration>