wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_send_document_isolation_policy_header › WordPress Function

Seit7.2.0
Veraltetn/v
› wp_send_document_isolation_policy_header ( Keine Parameter )
Gibt zurück:
  • (bool) Whether the header was sent. False if the browser does not
    support Document-Isolation-Policy or headers were already sent.
Definiert in:
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.


Quellcode

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;
}