From 9dccb8e20cee653b451e9e3226ed243c49e65fc7 Mon Sep 17 00:00:00 2001 From: sienori Date: Fri, 3 May 2019 05:23:55 +0900 Subject: [PATCH] Fix not working in cross domain iframe --- src/content/components/TranslateContainer.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/content/components/TranslateContainer.js b/src/content/components/TranslateContainer.js index 47fbdd2..822374f 100644 --- a/src/content/components/TranslateContainer.js +++ b/src/content/components/TranslateContainer.js @@ -108,7 +108,12 @@ export default class TranslateContainer extends Component { disableExtensionByUrlList = () => { const disableUrlList = getSettings("disableUrlList"); const disableUrls = disableUrlList.split("\n"); - const pageUrl = top.location.href; + let pageUrl; + try { + pageUrl = top.location.href; + } catch (e) { + pageUrl = document.referrer; + } const isMatched = disableUrls.some(urlReg => { if (urlReg.trim() === "") return false;