On Safari Mobile and iOS version 16 or 17, while scrolling the webpage, the function browser.tabs.captureVisibleTab() is not returning the expected screen image.
The image is cropped from the top.
The probable reason for the same is the collapsible Address Bar.
The below attached image is the iPad mini (6th generation ) Simulator OS Version:17.0 simulator
The below attached image is created by browser.tabs.captureVisibleTab()
I tested it on
iPad mini (6th generation ) Simulator OS Version:17.0 and
iPad (8th generation) - iPadOS Version 16.2.
Safari Extensions
RSS for tagEnhance and customize the web browsing experience on Mac, iPhone, and iPad with Safari Extensions
Posts under Safari Extensions tag
100 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hey,
Is it possible to automatic install AppStore extension on Mac clients without interaction from the user?
We have a lot of users who don't have an Apple ID. And as we have quite a lot of freelancers and temporary workers we mostly have users without an Apple ID and find it not making sense for these users to create an ID.
Any ideas?
Thanks.
I'm building a Safari content blocker extension. The app is able to use SFContentBlockerManager.reloadContentBlocker to update the content blocker's JSON rules.
However, I'm also trying to update the rules in the background through a daemon. The daemon app is embedded inside the main app, and is registered by the main app through SMAppService.
The issue I'm running into is I can't get both the GUI app and the daemon to both update the content blocker:
If I embed the Safari extension inside the main app and not the daemon, the main app is able to update the extension, but the daemon fails with an "operation couldn’t be completed" error (supposedly because it isn't the owner of the app)
Alternatively, if I embed the extension inside the daemon, the main GUI app can no longer update the extension (also failing with "operation couldn't be completed"
If I try to embed the extension inside both the main app and the daemon, it works fine when running from Xcode, but App Store Connect verification fails because it won't allow an bundle ID with two periods after the main app ID (e.g. the main app is com.example.App, the daemon is com.example.App.daemon, and the extension is com.example.App.daemon.extension)
I'm wondering if I'm missing something here? Is there a way to get Safari to recognize both the main app and the daemon as "owners" of the extension?
Thanks in advance!
My Chrome extension runs fine on Chrome, but when I use the following command to run it on Safari, I find that the result returned by chrome.runtime.sendMessage is always Undefined.
xcrun safari-web-extension-converter --app-name MySafariTest dist
The following is my code content.js:
async test() {
return chrome.runtime.sendMessage({
method: "test"
})
}
let result = await this.test()
// result is always undefined
background.js:
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
sendResponse("test123")
});
I want to know if there is any way to make the content script and background script of Chrome communicate normally in Safari?
safari web extensions cannot carry cookies through jquery ajax in popup scripts. I found that it is possible in Chrome, but when converted to run on Safari using safari-web-extension-converter, the ajax requests do not pass the cookie over. Is there any way to solve this problem?
I am writing a midi polyfill, to bridge Core Midi with Safari. This, in itself, is not a problem. The problem is that the Web Extension will get suspended the moment it's no longer actively called. This means that no callbacks due to midi changes from core midi can be passed back to the web page.
If I use a setInterval call in background.js, then this keeps the extension alive somewhat, but the setInterval self ping will get aborted eventually, making the Extension suspend itself.
I know of a fairly contrived workaround using the container application over XPC, but I am hoping there is a way to keep the Web Extension alive - or at least keep a thread in the same process as the Web Extension alive. Or any such workaround. Setting background to "persistent": true does not seem to make any difference.
Hi Everyone, We are using mac os 13.6.1, Xcode Version 14.2 (14C18). We have create a new target in the project for "Share Extension". After running the code our app is not visible when we share content from apple news and safari. Please do let me know in case anyone need more information. Thanks in Advance.
Hi,
Currently, our app extension needs to get PDF file( Safari generates itself from the url) with Reader PDF options mode( or PDF options mode).
So, How to get PDF file in Safari with Reader PDF options mode( or PDF options mode) for our app extension?
Is there any need to declare anything special in the Info.plist file of the extension?
Does the Safari extension support exporting these PDF files? Or only used for OS default apps?
Thanks.
Is there a way to pass/read cookies from SFSafariViewController to my application?
Hi,
I'm trying to convert a chrome extension to a safari extension and I have some unsupported permissions that don't work in safari. They are
chrome.enterprise.networkingAttributes
and
chrome.enterprise.deviceAttributes
Is there a way to get the ip address of the device in a Safari extension. The page we use this in is written in typescript.
Thank you
In Safari 17.0 App Extension user is able to modify per-site permissions due to which
extension is not able to inspect the url's and content.
Is there any way to restrict the user from modifying per-site permissions for the specific extension through api or mdm ?
If I store a wep page as WebApp on MacOS, as described here:
https://support.apple.com/de-de/104996
I cant use any Safari plugins in that WebApp
How to use plugins? is it blocked by MacOS/Safari generally? Does the Safari Plugin/Extension need to support this explicitly?
To reproduce this bug:
Create a simple Safari App Extension using the SFSafariWindow.getAllTabs method
Open a few tabs in Safari and save them to a named tab group
Quit Safari with Command + Q
Open Safari and navigate to the saved named tab group (do not navigate to other tabs, those non-active tabs will be suspended until we navigate to them)
Trigger the SFSafariWindow.getAllTabs method in our Safari App Extension
Ideally we should get all tabs in the tab group of the window, but instead we only get the active tab
Did I miss anything to make it work as expected?
When using a content rules file prepared for Safari with a size of, for instance, 20MB, we encountered a crash on iOS 17.
This is surprising given that just a few versions back Safari has increased the content rules limit to 150k. Now with this issue introduced, even when a content blocker is under the old 50k limit, we may not be able to register it.
Technical Details:
We use a class that implements the beginRequest(with context: NSExtensionContext) method from the NSExtensionRequestHandling protocol.
For this implementation, we utilize NSItemProvider initialized with init(contentOf: URL), where the URL points to path/to/file.json.
The crash arises when invoking context.completeRequest(returningItems: [], completionHandler: nil), with context being an instance of NSExtensionContext. Notably, using the same 20MB file and identical code, no such crash was observed on iOS 16.6.1 or iOS 12.5.7.
Steps to Reproduce:
In the host app, invoke SFContentBlockerManager.reloadContentBlocker(...).
Within the beginRequest(with context: NSExtensionContext) method of the class implementing the NSExtensionRequestHandling protocol:Instantiate NSItemProvider(contentOf: <PATH/TO/FILE.json>) using a large-sized rule set (e.g., 20MB or more).
Execute context.completeRequest(returningItems: [], completionHandler: nil).
Note: The issue is specific to iOS 17. On other versions, no crash is observed.
Expected behavior:
The content blocker extension should operate without crashing.
Actual behavior:
The content blocker extension crashes.
Also, we have opened another ticket in Feedback Assistant, its ID: FB13282146.
UPD: We recently tested on iOS 17.1.1, and the issue still persists.
When using password autofill on Safari 17.1 (Sonoma 14.1 on M1 Mac), and a third party password manager, the quicktype bar doesn't appear.
However on an Intel Mac with the same version of Sonoma and same Autofill configuration, it works as seen on Ventura.
Feedback assistant report has been submitted (FB13333122).
Hi there, I've run into an issue when using runtime ports to communicate between the popup and the background of an extension. Specifically, onConnect (in the background page) is not being triggered when my extension page is displayed subsequently to a Declarative Net Request Redirection.
Basically, I have DNR that redirect from 'app.mydomain.com' to my extension with a rule such as :
{
priority: 1,
action: {
type: 'redirect',
redirect: {
regexSubstitution: `safari-web-extension://mknlkpphjfngbollbeipeekihpdomdmd/index.html\\1#/\\2`,
},
},
condition: {
regexFilter: `^https?://w*\\.?app\\.mydomain\\.com(\\??[^/#]*)[^#]*#?/?(.*)$`,
resourceTypes: ['main_frame'],
},
},
The redirect works fine, but the onConnect is never triggered in the background page.
If I load the page extension directly (without a redirect being done), it works absolutly fine.
I see no error or warning. Any idea on why this issue occurs and how I could solve it ?
Thanks a lot
Hello,
I have a macOS app that helps navigation through running apps published on the App Store.
I would like to create a Safari extension for macOS that would allow the user to open directly one of the last used tabs. Activate a tab is not a problem following the documentation, but my question is: can I allow the opening of a tab that is not in the frontmost window of the current instance of Safari?
Security policies about window.focus() function are restrictive also for code executed directly in the "background" script of the extension?
P.S.
For example, in a Sandbox application you cannot activate directly a window but just a running application as it was left, so I cannot select the interested Safari's window from the macOS app.
Thank you!
Hi guys I'm developing an extension for Safari using web browser api but Safari does not support management object and getSelft() function. Does anyone know how to check if the extension is installed in development mode?
window.browser.management.getSelf(({ installType }) => {
if(installType === "development") {
// Do some stuff...
}
})
I made a extension using safari extension in Xcode, I tried to find ways to run it and test, was able to test it but was not able to add it on my safari, is there any guidance or solution for it?
Hello, I try to develop extension for safari. I edited info.plist but I can't see my menu items.
My Info.plist page
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.Safari.web-extension</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler</string>
</dict>
<key>SFSafariContextMenu</key>
<array>
<dict>
<key>Text</key>
<string>Search for selected text in MyApplication.</string>
<key>Command</key>
<string>Search</string>
</dict>
<dict>
<key>Text</key>
<string>Add an entry for selected text in MyApplication.</string>
<key>Command</key>
<string>Add</string>
</dict>
</array>
<key>SFSafariWebsiteAccess</key>
<dict>
<key>Level</key>
<string>All</string>
</dict>
</dict>
</plist>