wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_send_document_isolation_policy_header › WordPress Function

Since7.2.0
Deprecatedn/a
› wp_send_document_isolation_policy_header ( No parameters )
Returns:
  • (bool) Whether the header was sent. False if the browser does not
    support Document-Isolation-Policy or headers were already sent.
Defined at:
Codex:

Sends the Document-Isolation-Policy header for cross-origin isolation.

The isolate-and-credentialless directive loads cross-origin subresources without credentials instead of blocking them, so no crossorigin attribute is needed on scripts, styles, images, audio, or video for the page to work. Forcing crossorigin="anonymous" would turn those into CORS requests and break any resource served without Access-Control-Allow-Origin.


Source

function wp_send_document_isolation_policy_header(): bool {
	global $_wp_cross_origin_isolated;

	if ( headers_sent() || ! wp_is_document_isolation_policy_supported() ) {
		return false;
	}

	header( 'Document-Isolation-Policy: isolate-and-credentialless' );

	$_wp_cross_origin_isolated = true;

	return true;
}