给每个图片单独设置 referrerPolicy

page-bangumi.php中设置了全局referrer规则:不发送referer。如果开启了PJAX局部刷新,从追番页面去到其它页面该规则也会被保留,这会导致后面的请求也不发送referer。如果有资源比如CDN禁止空referer请求,那么这部分资源就会无法访问。
This commit is contained in:
LinGe 2022-06-21 19:54:37 +08:00
parent 0128ba483b
commit 74d7f2adbe
2 changed files with 3 additions and 4 deletions

View File

@ -50,7 +50,7 @@ class Bilibili
} }
$html .= '<div class="column"> $html .= '<div class="column">
<a class="bangumi-item" href="https://bangumi.bilibili.com/anime/' . $list['season_id'] . '/" target="_blank" rel="nofollow"> <a class="bangumi-item" href="https://bangumi.bilibili.com/anime/' . $list['season_id'] . '/" target="_blank" rel="nofollow">
<img class="bangumi-image" src="' . str_replace('http://', 'https://', $list['cover']) . '"/> <img class="bangumi-image" referrerPolicy="no-referrer" src="' . str_replace('http://', 'https://', $list['cover']) . '"/>
<div class="bangumi-info"> <div class="bangumi-info">
<h3 class="bangumi-title" title="' . $list['title'] . '">' . $list['title'] . '</h2> <h3 class="bangumi-title" title="' . $list['title'] . '">' . $list['title'] . '</h2>
<div class="bangumi-summary"> ' . $list['evaluate'] . ' </div> <div class="bangumi-summary"> ' . $list['evaluate'] . ' </div>

View File

@ -5,7 +5,6 @@
*/ */
get_header(); get_header();
?> ?>
<meta name="referrer" content="same-origin">
<style> <style>
#content,.comments,.site-footer{max-width:1200px;} #content,.comments,.site-footer{max-width:1200px;}
.comments{display: none} .comments{display: none}