リビジョン | e4b93ba0df1d0dc6aee2b9439c72e407ed2ff1e4 (tree) |
---|---|
日時 | 2018-03-25 17:30:17 |
作者 | umorigu <umorigu@gmai...> |
コミッター | umorigu |
BugTrack/2462 Customize Referrer Policy by HTML meta header
Some modern HTML5 web browsers supprt <meta name="referrer" />.
For example, content="no-referrer" means the browser don't send
any Referer headers to web servers.
@@ -17,6 +17,7 @@ function catbody($title, $page, $body) | ||
17 | 17 | global $javascript, $nofollow; |
18 | 18 | global $_LANG, $_LINK, $_IMAGE; |
19 | 19 | global $auth_type, $auth_user; |
20 | + global $html_meta_referrer_policy; | |
20 | 21 | |
21 | 22 | global $pkwk_dtd; // XHTML 1.1, XHTML1.0, HTML 4.01 Transitional... |
22 | 23 | global $page_title; // Title of this site |
@@ -334,6 +334,12 @@ $external_link_cushion = array( | ||
334 | 334 | ); |
335 | 335 | |
336 | 336 | ///////////////////////////////////////////////// |
337 | +// Output HTML meta Referrer Policy | |
338 | +// Value: '' (default), no-referrer, origin, same-origin, ... | |
339 | +// Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy | |
340 | +$html_meta_referrer_policy = ''; | |
341 | + | |
342 | +///////////////////////////////////////////////// | |
337 | 343 | // $whatsnew: Max number of RecentChanges |
338 | 344 | $maxshow = 500; |
339 | 345 |
@@ -62,6 +62,7 @@ header('Content-Type: text/html; charset=' . CONTENT_CHARSET); | ||
62 | 62 | <head> |
63 | 63 | <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CONTENT_CHARSET ?>" /> |
64 | 64 | <?php if ($nofollow || ! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?> |
65 | +<?php if ($html_meta_referrer_policy) { ?> <meta name="referrer" content="<?php echo htmlsc(html_meta_referrer_policy) ?>" /><?php } ?> | |
65 | 66 | |
66 | 67 | <title><?php echo $title ?> - <?php echo $page_title ?></title> |
67 | 68 |
@@ -562,6 +562,7 @@ header('Content-Type: text/html; charset=' . CONTENT_CHARSET); | ||
562 | 562 | <head> |
563 | 563 | <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CONTENT_CHARSET ?>" /> |
564 | 564 | <?php if ($nofollow || ! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?> |
565 | +<?php if ($html_meta_referrer_policy) { ?> <meta name="referrer" content="<?php echo htmlsc(html_meta_referrer_policy) ?>" /><?php } ?> | |
565 | 566 | |
566 | 567 | <title><?php echo $title ?> - <?php echo $page_title ?></title> |
567 | 568 |