Safari Extensions

RSS for tag

Enhance and customize the web browsing experience on Mac, iPhone, and iPad with Safari Extensions

Safari Extensions Documentation

Posts under Safari Extensions tag

112 Posts
Sort by:
Post not yet marked as solved
1 Replies
69 Views
Since updating to iOS v17.4.1 our safari extension no longer functions as it used to We are experiencing issues where our content script is not getting initialized, On devices running iOS 17.4.1, the content script included in our extension does not appear to run. There are no logs from the content script in the console, whereas on other versions and devices, it operates as expected. Our Extension relies con communication between the background and content scripts in order for us to render various popups to our users, based on our logs as of iOS 17.4.1 this communication is not successful, we can see messages being sent from the background script but as mentioned above nothing on the content script side. This behavior happens majority of the time and on random sites, sometimes opening the same site in a new tab would work but not always. There are also times where we would only receive our popups after opening the safari menu and interacting with our extension via this menu. Please assist with a way forward
Posted Last updated
.
Post not yet marked as solved
0 Replies
93 Views
We have an app with a web extension for Safari. We developed this app for a couple of years. Recently when we pushed an update to TestFlight or the Mac App Store, the user that updated the app, there's the dialog from macOS that asks to : Close Safari to continue the update. Click on continue to quit "safari" … It seems a recent change. Is there a way to prevent quitting Safari when we push to update to TestFlight and Mac App Store?
Posted
by jlapalme.
Last updated
.
Post not yet marked as solved
1 Replies
137 Views
I'm trying to develop a Safari app extension and want to enable a persistent background page for it. I could find examples of how to enable it for Web extensions using manifest.json, but for App Extension it seems that I need to use Info.plist and I couldn't find any documentation on it. How can I use the background page?
Posted Last updated
.
Post not yet marked as solved
1 Replies
181 Views
I have created a new build for my Safari web extension and distrbuted it to test flight. Test Flight says I am using the correct version - but when I go to the Setting > Extensions in Safari and enable it - it still has the old version number. App Store showing the correct version is in testing Test Flight confirming said version number Safari with the incorrect version Any idea what I am doing wrong?
Posted Last updated
.
Post not yet marked as solved
0 Replies
186 Views
I've created a Safari extension using Xcode, and it works fine on my local system. However, when I try to deploy the extension, I encounter an error message stating "No team found in archive." I've already added the team while setting up the extension. Could someone please assist me in identifying what I might be doing incorrectly? Below are screenshots showing my configuration and the error message I'm encountering during deployment. Following are the configuration screeshots Following is the error screeshot
Posted Last updated
.
Post not yet marked as solved
0 Replies
146 Views
Hi, I converted a chrome extension to safari extension and in order to pass review I have to have a thorough description in the safari extension pane (which is within safari when you configure/setup the extension) Do anybody know where I can change this description in xcode? Tyler
Posted
by birdty.
Last updated
.
Post not yet marked as solved
7 Replies
1.6k Views
Hi! I'm working on an iOS Safari extension that has a ServiceWorker. Lately we've noticed that this ServiceWorker seems to get killed seemingly at random, and there are no logs or crash reports to tell us what happened. I'm hypothesizing that iOS might be shutting down Safari ServiceWorkers when the ProcessInfo.thermalState approaches .serious. I have circumstantial evidence that our ServiceWorker tends to get killed more often at higher levels of thermalState but can't yet say conclusively that this is the case. I can't find any direct evidence of this on internet searches either. Is anyone able to shed light onto this topic? The specific symptoms are: ServiceWorker stops, and the menu entry for its console window no longer appears on macOS Safari. No crash logs via Xcode or Sentry, and no Console messages as far as we could tell (caveat: MobileSafari generates a LOT of messages! We might have missed it.) If attached via debugger, the native part of our extension just disappears and the debugger loses connection with no error message. ServiceWorker no longer works for the lifetime of the Safari process. Sometimes, when we kill Safari and restart, we can get the ServiceWorker back. This usually requires toggling our extension's "enabled" state in system settings. In some cases, even killing/relaunching Safari and toggling the system setting doesn't bring our ServiceWorker back. I'm hypothesizing right now that this happens when the thermal state is high. I've tried simulating a serious/critical thermal state in the Xcode Devices window, but couldn't repro the ServiceWorker problem. I don't know if that setting affects the whole system, though, or just our own apps. Help appreciated! Yuna
Posted Last updated
.
Post not yet marked as solved
0 Replies
146 Views
I want to develop a safari extension for a study for a pet project website. I want to understand the challenges faced by the users while making searches on my e-commerce website. So the extension would basically trigger a survey when active on my website. If I were to understand what was searched on the website I would need to capture the url for the current page on they are on. Would this be possible? Would it comply with Apple regulation policies?
Posted
by Parth_k.
Last updated
.
Post not yet marked as solved
1 Replies
218 Views
My Safari App Extension is having trouble with one website. This is typical for some other websites as well. Navigating to that website results in 6 “Load” events. For each such event I send a “safari.extension.dispatchMessage” to my objC code. For the first of these Load messages, my objC code sends a ‘sendMeIcons” message to “safari.self.addEventListener('message', function(event)”. The other 5 Load events are ignored by my objC code and do not send this message. safari.self.addEventListener('message', function(event) receives sendMeIcons JUST once. Yet, the event handler for this message) is invoked 4 times. The first invocation is correct. The other 3 are spurious. I have no idea why this is happening. Here is my objC code safari.self.addEventListener('message', function(event) { if (event.name === "Load My URL") { console.log('In event listener Load My URL'); ... return; } if (event.name === "sendMeIcons") { ... if (hrefs.length <1) //THIS IS ALWAYS TRUE FOR THIS TEST CASE. { safari.extension.dispatchMessage("js Found No Icons"); return; } else { ... safari.extension.dispatchMessage("IconsReturned",{"urls": arrayOfUrls}); return; } } I don't have a clue how to proceed. Any suggestions.
Posted Last updated
.
Post not yet marked as solved
0 Replies
223 Views
Can someone share how secure is the communication between iOS app and its safari mobile extension. Is it encrypted? Are there any references to best practices to follow? If a user has opened multiple tabs and has multiple extensions can there be security issues during their communication like one extension able to read other extensions memory?
Posted
by vmvinoth.
Last updated
.
Post not yet marked as solved
0 Replies
219 Views
The SFSafariViewController documentation mentions not to display content from websites when using the pageSheet and formSheet presentation styles for the In-App browser. Is this a hard restriction that is enforced or more of a loose guideline? And if possible, providing the reasoning behind it would be great. Thanks in advance.
Posted
by CreaseK.
Last updated
.
Post not yet marked as solved
0 Replies
201 Views
Is there any way to configure SFSafariApplication.dispatchMessage to send a message to the web extension from a specific profile? According to the documentation , using SFExtensionProfileKey, the native app can determine the profile that sent a message. Can SFSafariApplication.dispatchMessage send a message to a specific profile? The default behavior seems to be to send the message to all profiles.
Posted
by AlexCaba.
Last updated
.
Post not yet marked as solved
1 Replies
337 Views
I recently noticed that using Google Docs, Google Sheets, and any other Google-related sites on a Safari browser uses tons of RAM. It usually consumes around 4-5 GB of RAM. Compare it to when I use Google Docs on Chrome; it only uses around 1-2 GB. Why is this so? I want to use Safari alone for work, but it's so slow. Do you have any tips on this?
Posted
by PMLO.
Last updated
.
Post not yet marked as solved
0 Replies
206 Views
Hey, I am developing Safari Web Extension and trying to communicate with the swift handler (SafariWebExtensionHandler) using runtime.sendNativeMessage api (as describe here - https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_between_the_app_and_javascript_in_a_safari_web_extension). I'm getting the following error when calling it - calling runtime.sendNativeMessage(): Error Domain=NSCocoaErrorDomain Code=4099 "Couldn’t communicate with a helper application." I have no Idea what is missing and couldn't find any meaningful error message anywhere. I do have nativeMessaging permission in my manifest.json. Assist will be appreciated.
Posted
by guyholl.
Last updated
.
Post not yet marked as solved
1 Replies
235 Views
Hello, Is it possible to take a screenshot of a non-active tab? Firefox supports this via captureTab (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/captureTab) With Safari App extensions that was possible via getScreenshotOfVisibleArea which doesn't seem to work with Safari extensions.
Posted
by bruno.cm.
Last updated
.
Post not yet marked as solved
1 Replies
287 Views
We're seeing a delay of between 50mS to 150mS when just sending a short "ping-pong" message between 'inject.js -> extension code (swift) -> inject.js' what might be wrong? are there any ways to get a more reasonable IPC communication channel between the javascript and swift side. I would like to achive <= 1mS delay roundtrip.
Posted
by jomentino.
Last updated
.
Post not yet marked as solved
1 Replies
396 Views
I am developing a safari extension When a redirect occurs on a web page, I want to detect the redirect and obtain all redirect URLs. If there is any way, please let me know Below is what I tried manifest version is 3 1, Use webNabvigation in background.js browser.webNavigation.onBeforeNavigate.addListener(function(details) { console.log("Redirected to:", details.url); }); This works, but I couldn't get the expected URL 2, Use webRequest in background.js This resulted in an error as it was not possible to listen to events in a non-persistent background. This is caused by using manifest version 3.
Posted Last updated
.
Post not yet marked as solved
0 Replies
245 Views
I've successfully built a Safari extension for my app, but I've noticed that some applications have a slightly different style when opening the native modal through the "aA" button (I'm not referring to the injected cloned modal, but the "native" one). There are two major differences I observed: the first is the header color, which is gray instead of the regular white, and the second is that this modal doesn't open in full screen when dragged to the top, unlike the regular one. I'm interested in knowing how they achieved this. I couldn’t find any information about it anywhere on the web/docs. Thanks!
Posted Last updated
.