-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{{url}} and {{title}} is undefined #15
Comments
This is interesting, I never thought that Behaver will have differences between Chrome and Firefox. And, Thanks for sharing this. Setting this as top priority, will fix it soon. |
Perhaps not Chrome vs. Firefox, since Vivaldi is using Chrome extension store, and also has the problem. Both can be fixed by adding the "tabs" permission, or even better, by explicitly requesting <all_urls> host permission:
Since we already requested content_scripts on <all_urls>, this way we requests one less permission from user. This is a bit weird, since I thought content_scripts implies host_permission, but seems not in my PC. BTW, the Chrome manifest file seems to have some rendering bug in <all_urls>:
|
Interesting, I was try chrome and Firefox on my machine, both working fine. I don't want to bring unnecessary permission to users, but My OS is macOS 13.2.1(22D68) Below is the manifest I am using on Firefox Version 112.0.5615.121 (Official Build) (arm64). {
"version": "1.10.11",
"author": "eindex.lee@gmail.com",
"name": "Logseq Copilot",
"description": "Logseq Copilot, Connect with you logseq API server, bring your information when you browsing.",
"chrome_url_overrides": {},
"icons": {
"192": "assets/img/logo-192.png"
},
"content_scripts": [
{
"matches": [
"http://*/*",
"https://*/*",
"<all_urls>"
],
"js": [
"content-script.js"
],
"css": [
"content-script.css"
]
}
],
"permissions": [
"storage",
"activeTab",
"contextMenus"
],
"options_ui": {
"page": "options.html",
"browser_style": false,
"open_in_tab": true
},
"manifest_version": 2,
"background": {
"scripts": [
"background.js"
]
},
"web_accessible_resources": [
"content-script.css",
"assets/img/logo.png"
],
"browser_action": {
"default_popup": "popup.html",
"default_title": "Logseq Copilot"
},
"browser_specific_settings": {
"gecko": {
"id": "{dbe73d0a-f6b8-474a-ad39-0d46a07e4525}"
}
}
} And this for Chrome Version 112.0.5615.121 (Official Build) (arm64): {"version":"1.10.16","author":"eindex.lee@gmail.com","name":"Logseq Copilot","description":"Logseq Copilot, Connect with you logseq API server, bring your information when you browsing.","chrome_url_overrides":{},"icons":{"192":"assets/img/logo-192.png"},
"content_scripts":[{"matches":["http://*/*","https://*/*","<all_urls>"],
"js":["content-script.js"],
"css":["content-script.css"]}],
"permissions":["storage","activeTab","contextMenus"],
"options_ui":{"page":"options.html","browser_style":false,"open_in_tab":true},"manifest_version":3,"key":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnkAYeXnTWrNIu2h8D4xi9NHWLe0eTR3CX8DDw1c0qyCucaCKxkk/+gZcl89Ifyq5joXc/CeQrM3QVjrL1RAXrKZVqTNvBCUh1H1oJJ47nqkKKI6bNZVT8utjFTjDD1ZYXPYzQhsGuP/cY1wIrlhhIuawFW1h+UUwYlYQtS5FcjJ/RPrao+8KwJaS9p3Cei9rWXhE/PV19ZVOqOUx9ZSzj5/OYCB1u1VWFD5BlUbTXSbzyM/VvXZseAVruVy7oRHJ565AH/uPz2ZVL55Gz0LzcHw4HNRc2f+mSVAbHAuK7JDWtRlrZ3Fbav9qBrcVIAxTpnf5B2I2YMBMcu852Vkc3QIDAQAB","background":{"service_worker":"background.js"},"web_accessible_resources":[{"resources":["content-script.css","assets/img/logo.png"],"matches":[]}],"action":{"default_popup":"popup.html","default_title":"Logseq Copilot"}} |
Signed-off-by: EINDEX <snowstarlbk@gmail.com>
You are actually not requesting any additional permissions by using host_permissions, since you already requested "Access your data for all websites" with context_scripts. Anyway, this is very weird since we are using the same browser versions, the only difference seems to be Mac vs Linux. Maybe we close this issue for now (until someone else encounters the same problem)? I can do with using the right-click menu (it works) instead of the floating button to capture. |
I add permission back. |
Describe the bug
Clicking on the quick capture icon often results in {{url}} and {{title}} expands to 'undefined'.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Url and title always filled.
Desktop (please complete the following information):
Additional context
This can be fixed by adding 'tabs' permission to manifest.json.
As explained in https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions#api_permissions
you need this permission for tabs.url and tabs.title.
And as in https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions#activetab_permission
you can read the url and title of the active tab, but only after the user clicks the extension icon.
The text was updated successfully, but these errors were encountered: