Skip to content

documentDomains

Reports uses of document.domain which relaxes same-origin protections.

✅ This rule is included in the browser logical presets.

The document.domain API changes the origin the browser uses for same-origin checks. Setting it can let pages on related subdomains access each other when the browser would otherwise keep them isolated. Use location.hostname or location.origin when you only need to read the current page’s host or origin.

document.domain = "example.com";
window.document.domain = "example.com";

This rule is not configurable.

If you maintain a legacy app that temporarily depends on cross-subdomain same-origin relaxation while migration is in progress, it may be reasonable to disable this rule for those files. For new code, prefer current host checks or server-side origin configuration instead.

Made with ❤️‍🔥 around the world by the Flint team and contributors.