Questions tagged «browser-compatibility»

1
wp_headers与send_headers。什么时候使用每个?
我已经看过wp_headers并且send_headers都用于同一件事,而且我想知道您是如何知道要使用哪个以及何时使用的... 在send_headersCodex页面上,有一个添加X-UA-Compatible: IE=edge,chrome=1for Internet Explorer向后兼容性的示例,因为如果太晚加载,meta标记在Intranet网站上通常会失败。 该send_headers示例如下所示: add_action( 'send_headers', 'add_header_xua' ); function add_header_xua() { header( 'X-UA-Compatible: IE=edge,chrome=1' ); } 但是wp_headers也可以这样做: apply_filters ( 'wp_headers', array $headers, WP $this ) add_filter( 'wp_headers', 'wpieeam_headers' ); function wpieeam_headers($headers) { if (!is_admin()) { $headers['X-UA-Compatible'] = 'IE=edge,chrome=1'; } return $headers; } 更新:我实际上只是注意到,几年前关于这个问题的对话或多或少开始了…… 另外,send_headers是否仅与前端有关?我已经看到wp_headers做这样的检查: if ( isset($_SERVER['HTTP_USER_AGENT']) && …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.