GateCheck

How to Stop Other Sites Embedding Your Website

An iframe lets one website display another page inside a frame. That can be useful for an approved partner, but unwanted framing can confuse visitors or make your page appear in a context you did not choose. Decide whether to block all framing or allow specific sites.

Published

Understand what an iframe does

An iframe loads a page from one address inside another page. The framed page still comes from its own server, but the visitor sees it within the outer site. Owners sometimes allow this for maps, videos, widgets, or a partner integration. It can also be used to present a page without the surrounding context the owner intended.

Blocking framing is different from blocking a direct visit to your site. A person can still open the page in its own tab unless you also restrict access separately. Before changing headers, identify which pages should be framed and which partner origins, if any, need access.

Use a response header for a broad policy

The Content Security Policy frame-ancestors directive controls which parent origins may embed a response. To prevent other origins from framing pages, send a policy such as Content-Security-Policy: frame-ancestors 'self' in the HTTP response. Configure it where your server or hosting platform sets response headers, and verify that the header is present on the pages you intend to protect.

If you need to allow a partner, list the exact origin in the policy rather than using a broad wildcard. A response header is more appropriate for this browser-enforced framing rule than adding ordinary text to the page. Test your own login, payment, or widget flows before applying the same policy site-wide, since legitimate integrations may rely on framing.

Content-Security-Policy: frame-ancestors 'self' https://partner.example

Allow selected partners with GateCheck

GateCheck includes an embedding control for protected pages. A site owner can block framing and issue embed keys for approved partner sites. The partner puts its key on the iframe request; GateCheck checks whether the key belongs to that embedding site. Without an allowed key, the framed page is replaced with an explanation and a request option.

Keys are scoped to the website they were created for, which limits accidental reuse. GateCheck also documents a universal key option, but anyone who obtains such a key can use it more broadly. Prefer a key for each partner, share it only with the intended site owner, and revoke it if the relationship ends.

<iframe src="https://example.com/?gc_embed=YOUR_PARTNER_KEY" width="600" height="400"></iframe>

Choose between headers and an application rule

A response header is a direct browser policy for framing. GateCheck’s embedding feature adds an application-level decision and can show a request page for an unapproved frame. Your site may use one or both, depending on how it is hosted and how partner access should work. Do not assume one mechanism automatically configures the other.

If you use a strict frame-ancestors header, test that the browser can still load pages for the partners you intend to allow. If GateCheck handles partner keys, test the key from the partner origin and test a missing or incorrect key. Ensure that visitor protection still works for an allowed frame, including the path when a visitor needs a CAPTCHA.

Test the policy in real browsers

Create a small test page on a different origin and try to embed a protected page. Check the browser console and response headers to confirm which rule blocked or allowed it. Test a direct page visit too, so you know that the policy affects framing rather than ordinary navigation. Repeat on a partner origin if you allow one.

GateCheck’s dashboard shows how many people saw your pages inside each other website over the last 30 days. Only the counts are kept, with nothing about the viewers, and bots aren’t counted. Use them to see whether embedding is happening, but don’t treat them as a complete record of every frame.

Keep framing rules maintainable

Record why each partner is allowed, who owns the integration, and when the permission should be reviewed. Remove stale origins and keys. If your site is behind a CDN or reverse proxy, confirm that it preserves the intended response header instead of replacing it on some routes.

A framing policy is only one part of protecting a page. It does not authenticate a user, hide content already sent to a browser, or stop every kind of abusive request. Use the server checks and access controls appropriate for the information on the page. See the GateCheck embedding docs for the current key flow.

Related guides