wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_send_document_isolation_policy_header › WordPress Function
Since7.2.0
已弃用n/a
› wp_send_document_isolation_policy_header ( 没有参数 )
| 返回: |
|
| 定义在: |
|
| 文档: |
Sends the Document-Isolation-Policy header for cross-origin isolation.
Theisolate-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.
Sending the header also opts the screen's media frames into client-side
uploads, so call this before wp_enqueue_media() runs.源码
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;
}