diff --git a/apply-css/background.js b/apply-css/background.js index 3c0b1aad..039a6974 100644 --- a/apply-css/background.js +++ b/apply-css/background.js @@ -29,9 +29,8 @@ function toggleCSS(tab) { Returns true only if the URL's protocol is in APPLICABLE_PROTOCOLS. */ function protocolIsApplicable(url) { - var anchor = document.createElement('a'); - anchor.href = url; - return APPLICABLE_PROTOCOLS.includes(anchor.protocol); + const protocol = (new URL(url)).protocol; + return APPLICABLE_PROTOCOLS.includes(protocol); } /*