Post

Replies

Boosts

Views

Activity

Reply to Push subscribe error User denied push permission
Safari (17.1, at the time of writing this answer) still does not support any form of push or local notifications inside Safari Web/App Extensions. Although Safari 16 has introduced the relevant Notifications API (including Web Push API), it is available only for regular websites, and not for Safari Web/App extensions. The legacy Safari Push Notifications are also available only for regular websites and not for extensions. Hmm it seems Push or local notifications are still not supported for Safari Extension :-/ https://stackoverflow.com/questions/75660781/can-macos-safari-web-extensions-issue-local-notifications-without-asking-for-per Thanks for confirming...
Topic: Safari & Web SubTopic: General Tags:
Mar ’25
Reply to Error: Invalid call to runtime.connect(). No runtime.onConnect listeners found.
I don't see why the runtime.onConnect event listener cannot be found. According to my code in background script, it should be initialised: // Listener on sent parsed ID list from content script to be resolved currentBrowser.runtime.onConnect.addListener((port) => { port?.onMessage.addListener(async ({ parsedIdList }) => { if (parsedIdList?.length > 0) { // some logic here } }); });
Topic: Safari & Web SubTopic: General Tags:
Sep ’24
Reply to Error: Invalid call to runtime.connect(). No runtime.onConnect listeners found.
Hi, Thanks for your support. in order to be clearer, I'll give more accurate info: Our add-on project web site (only usage and install doc): https://clickandread.inist.fr The command I use to trigger a build with Xcrun: xcrun safari-web-extension-converter --app-name "Click and Read" --bundle-identifier fr.inist.Click-and-read --swift --force --macos-only dist Once the safari converter having launched Xcode with the generated project, I click on play to build this project. Then I get the add-on app built (with some errors ?) ready to be opened and activated in Safari. Once my add-on enabled and set, I browse on a dedicated testing page, which should be injected with add-on content script (to display some C&R green buttons on the page). Unfortunately, either on LTS or Preview Safari, I get the same error in console... Please see attached screenshots.
Topic: Safari & Web SubTopic: General Tags:
Sep ’24
Reply to tabs onUpdated event not detected ?
After debugging I finally sloved this by noticing that in fact the events were triggered, but missed because of the availability and values of parameters passed into callabck (changeInfo, details) depending on the browser we're on. So I switched from onUpdated to webNavigation.onCompleted API, which is better suited to our need (tab page fully loaded) and whose parameter is simple and consistent across browsers :-) const uiLanguage = currentBrowser.i18n.getUILanguage().includes("fr") ? "fr" : "com"; // Detect browser language const gsUrl = `${GSCHOLAR_SETTINGS_HOST}.${uiLanguage}`; // Listener to detect when the GS tab has finished loading const gsTabListener = (details) => { if (details && details.url && details.tabId) { if (details.url.startsWith(`${gsUrl}/scholar_settings?`)) { currentBrowser.tabs.executeScript(details.tabId, { code: `document.getElementsByName("save")[0].click();`, }); } else if (details.url.startsWith(`${gsUrl}/scholar?`)) { currentBrowser.webNavigation.onCompleted.removeListener( gsTabListener ); currentBrowser.tabs.remove(details.tabId); } } }; currentBrowser.webNavigation.onCompleted.addListener(gsTabListener); // Add GS tab listener currentBrowser.tabs.create({ url: `${gsUrl}/scholar_settings?inst=${gScholarInstIdList.join( "&inst=" )}&save=#2`, active: false, }); // Open GS tab according to browser language
Topic: App & System Services SubTopic: General Tags:
Sep ’22