Skip to content
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

Safari Extensions Permission Banner Not Documented #741

Closed
wydgetlabsadmin opened this issue Dec 17, 2024 · 3 comments
Closed

Safari Extensions Permission Banner Not Documented #741

wydgetlabsadmin opened this issue Dec 17, 2024 · 3 comments
Labels
needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time

Comments

@wydgetlabsadmin
Copy link

I’m trying to figure out how to trigger the "Additional Permissions Requested" banner, like what extensions like Honey and Coupert do, but I haven’t had any luck. I've attached an example of the banner to this email. We’ve got <all_urls> in the manifest, but because Safari exposes the ability to only give permission for the extension to run on certain domains, its possible for us to not ACTUALLY have the <all_urls> permission. In these situations, I’ve been trying things like dynamically requesting permissions and injecting scripts when tabs are created, activated, or navigated.

For example: chrome.webNavigation.onCommitted.addListener(async ({ tabId, url }) => { try { await chrome.permissions.request({ permissions: ['scripting'], origins: [url!], }); await chrome.scripting.executeScript({ target: { tabId: tabId!, allFrames: false }, func: () => console.log('Injected'), world: 'ISOLATED', }); } catch (e) { console.error('Failed to inject script', e); } }); I’ve also hooked into tabs.onActivated, webNavigation.onDOMContentLoaded, and tabs.onCreated events, but nothing seems to trigger the banner.

Is there something I’m missing about how Safari handles this? Any advice or pointers would be super helpful.

image

@github-actions github-actions bot added needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time labels Dec 17, 2024
@fregante
Copy link

This kind of questions would be best asked on StackOverflow.

If you have <all_urls> in host_permissions, Safari should automatically show that banner once the browser is opened.

@wydgetlabsadmin
Copy link
Author

Well the question is if there any way to show the banner again if user has hit don’t allow in the past. Honey and Coupert seem to be able to have this functionality and it is not documented anywhere. There are stackoverflow questions of this nature with no responses.

We have functionality that requires the user to give this all_urls permission, but user sometimes accidentally hit don’t allow, causing a issues for them to be able to change their mind and re-add them

@carlosjeurissen
Copy link
Contributor

@wydgetlabsadmin As @fregante mentioned, this is not the place for such questions. There is documentation on permission requests on mdn:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/permissions/request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time
Projects
None yet
Development

No branches or pull requests

3 participants