Which CSP directive is the modern, preferred replacement for `X-Frame-Options` to prevent clickjacking?
- 1frame-src
- 2frame-ancestors✓ correct
- 3child-src
- 4navigate-to
Content-Security-Policy: frame-ancestors 'none'prevents any page from framing this one — the modern, more flexible replacement forX-Frame-Options: DENY. Unlikeframe-src(which controls what frames this page can load),frame-ancestorscontrols who can frame this page. It supports multiple trusted origins:frame-ancestors 'self' https://trusted.example.com.X-Frame-Optionsis still sent for older browser compatibility, but CSPframe-ancestorstakes precedence in supporting browsers.
frame-ancestors in CSP supersedes X-Frame-Options with finer-grained control.