summaryrefslogtreecommitdiff
path: root/_includes
diff options
context:
space:
mode:
authorjeffreytse <jeffreytse.mail@gmail.com>2021-06-28 17:34:53 +0800
committerjeffreytse <jeffreytse.mail@gmail.com>2021-06-28 17:34:53 +0800
commit78f2d77170a95ac420c8906bdb6659bf2487b7e2 (patch)
tree166dd0fd12f40722b2ccba8b6802a2679b338b34 /_includes
parent5c4c473b88e0734e7221bbd06fe875a64b99b65d (diff)
perf: links to cross-origin destinations are unsafe
Add `ref=noopener` to the `a.goog-logo-link` tag to solve the issue found out by Chrome lighthouse.
Diffstat (limited to '_includes')
-rw-r--r--_includes/extensions/google-translate.html6
1 files changed, 6 insertions, 0 deletions
diff --git a/_includes/extensions/google-translate.html b/_includes/extensions/google-translate.html
index 53d0996..ce1ef94 100644
--- a/_includes/extensions/google-translate.html
+++ b/_includes/extensions/google-translate.html
@@ -29,6 +29,12 @@ function googleTranslateElementInit() {
layout: google.translate.TranslateElement.InlineLayout.VERTICAL
}, 'google_translate_element');
+ // Links to cross-origin destinations are unsafe
+ var gll = document.getElementsByClassName('goog-logo-link')[0];
+ if (gll) {
+ gll.setAttribute('rel', 'noopener');
+ }
+
function restoreLang() {
var iframe = document.getElementsByClassName('goog-te-banner-frame')[0];
if (!iframe) return;