diff options
Diffstat (limited to 'extension')
-rw-r--r-- | extension/popup/main.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/extension/popup/main.js b/extension/popup/main.js index 1bf653a..1dc39f4 100644 --- a/extension/popup/main.js +++ b/extension/popup/main.js @@ -332,6 +332,11 @@ function loadRuleList({tab, siteSettings, selectRule}) { createRuleButton.appendChild(document.createTextNode('Create Rule')); + if (!new URL(tab.url).hostname) { + createRuleButton.disabled = true; + createRuleButton.title = `Sorry, this page doesn't appear to have a hostname. We can't create a rule here.`; + } + createRuleButton.addEventListener('click', () => { const {hostnameParts} = getURLParts(tab.url); const rule = { |