Post not yet marked as solved
How can I download safari-technology-preview-125?
when I click on the link(https://webkit.org/blog/11680/release-notes-for-safari-technology-preview-125/), I can download latest version which need macOS 12. however I have macOS 11.4 and need to debug my app && need all tab available in safari inspector.
Post not yet marked as solved
How do we access and write content to the group container? Also, apart from the SafariWebExtensionHandler's beginRequest(with:) function, is there some other native call back we can get?
Post not yet marked as solved
The content scripts specified in the manifest of an extension should be loaded each time a user visits a web page. However, in the iOS 15 simulator, the content script is only loaded the first time that the extension is enabled -- either when you grant permission for the site, or if you turn the extension off and back on while on a site. Otherwise, the content script is not injected. This is clearly a bug, right? Is there a known workaround or a fix in the works?
Post not yet marked as solved
Is it possible to open the native app from a web extension?
I have tried creating a new tab that uses the app's URL scheme but the UI asking the user to open the app is not shown until the new page UI is dismissed.
Creating a tab with an HTTPS URL that the app is setup to handle does not work and always the link in a new tab.
I tried sending a message to the app extension and using NSExtensionContext.open(_:completionHandler:) but the URL is not opened and the closure received false, indicating it was not handled.
Having the option to link back to the native app would be very useful.
Post not yet marked as solved
We have Safari App(!) Extension, the one that has no background page. We want to port it to a Safari Web Extension, so it can run on iOS 15.
The App Extension extensively uses safari.extension.dispatchMessage, and we want to replace it with browser.runtime.sendNativeMessage, which doesn't work at all.
There's a couple questions:
How to get a response from browser.runtime.sendNativeMessage
Do we have to use browser.runtime.connectNative? How to use it?
Where is the documentation on all of this?
Post not yet marked as solved
Is it possible to send messages between the container app and the extension when working with an iOS Safari Web Extension? It seems to work ok on MacOS, but I can't find any documentation on how this would work on iOS.
Any help would be greatly appreciated.
Post not yet marked as solved
I am currently developing a safari web extension on iOS.
The following piece of code is executed in the native application when the extension sends a message to the native app using browser.runtime.sendNativeMessage.
func beginRequest(with context: NSExtensionContext) {
let item = context.inputItems[0] as! NSExtensionItem
let message = item.userInfo?[SFExtensionMessageKey]
os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@", message as! CVarArg)
// Message should follow format of:
// {
// type: "Message type",
// payload: "Message Payload"
// }
// In the future we may want to parse the payload differently, but for now it is a string
guard let response = message as? [String : AnyObject] else {
return
}
guard let type = response["type"] as? String else {
return
}
guard let payload = response["payload"] as? String else {
return
}
let res = NSExtensionItem()
if type == "COPY" {
let itemToCopy = [payload]
let pasteboard = UIPasteboard.general
pasteboard.strings = itemToCopy
res.userInfo = [ SFExtensionMessageKey: [ "res": true ] ]
}
context.completeRequest(returningItems: [res], completionHandler: nil)
The code works flawlessly in the iOS 15 simulator, however it does not work on the actual device. ( iPod Touch 7th Generation running iOS 15 beta 2 )
There are no errors, it behaves as if it was working as expected.
Any help would be greatly appreciated.
Post not yet marked as solved
Is it possible to access ARKit with the Safari Web Extensions on the new iOS Safari Web Extensions?
Post not yet marked as solved
Command Used:
xcrun safari-web-extension-converter package-content.safariextension --project-location SafariExtension
While running the above command, I am getting below warnings. How to resolve these for Safari for iOS 15?
Warnings:
The following keys in your manifest.json are not supported by your current
version of Safari. If these are critical to your extension, you should review
your code to see if you need to make changes to support Safari:
manifest_version
icons
persistent
version
js
content_security_policy
matches
description
<all_urls>
tabs
cookies
activeTab
scripts
storage
applications
browser_action
web_accessible_resources
name
run_at
What are the correct sizes and colours to provide for the toolbar icon of a Safari Extension on iOS?
For the size I tried creating a solid black icon and measuring the size. They seem to render at 24x24pt but providing 24px, 48px, and 72px images still look blurry. This also only covers the default text size; the icons scales with the system text size.
The MDN documentation (which I cannot link here) says that an SVG can be used but supplying an SVG displays the app icon instead.
The example icons are all black (like other toolbar icons on iOS) but when displayed in dark mode they are still black, which does not match the other icons in the list. Do I need to specify black and white icons? I tried using browser_action's theme_icons but they seem to be ignored.
I've seen other solutions to switch out the icon at runtime but that requires a content script to be injected in to every page or for the popup to be opened by the user.
iOS is already tinting the icon blue when the extension is active, can it tint it white when inactive in dark mode?
Post not yet marked as solved
Hello,
I'm experimenting with the new Safari web extensions for iOS and iPadOS 15 but I'm hitting a wall when I try to execute a fetch request from the Web Extension Handler on a persistent store located in my app group container.
First of all, I have not found a good way to debug my extension native code from XCode so I want to ask if someone is aware of a way to debug or having crash logs regarding those extensions.
Regarding the CoreData issue, I can access the persistent store (checked with NSFileManager) in the group container and initialize my core data stack, but a simple fetch request without a predicate seem to result in a "no-response" error in the background script, possibly related to native code crash. The same code is run on another extension (Shortcuts) without problems. At this point in my testings, I'm unsure I took the wrong path and CoreDate can't be used by design, this is a beta bug or I'm missing something. Any clue is more than appreciated.
I have run my test mostly on iPadOS 15 latest beta release.
How do you add iOS support for an existing Safari WebExtension?
I tried running xcrun safari-web-extension-converter --rebuild-project /path/to/project.xcodeproj but that just shows the help text for the safari-web-extension-converter.
Is there any documentation that demonstrates a manual way to do this?
Specs:
Safari 14.1.1
macOS 11.4
Xcode 12.5.1
Post not yet marked as solved
I just converted a chrome extension with XCode command line
xcrun /Applications/Xcode-beta.app/Contents/Developer/usr/bin/safari-web-extension-converter /Users/macminitwo/Downloads/new-tab-background
which had no icon in manifest, after conversion there was build error
error: Build input file cannot be found: '/Users/macminitwo/camo theme/Shared (App)/Resources/Icon.png' (in target 'camo theme (iOS)' from project 'camo theme')
Then I updated manifest.json of main project and added icon to the project
"icons": { "16": "icon16.png", "48": "icon48.png", "128": "icon128.png" }
tried converting again, and it still gave same error.
Now, I have to manually put the icon in "resources" folder.
Note: every time on conversion, it said abort trap 6
What should I do to not get this error? And have icon there already.
System Info:
macOS: 11.4 Big Sur
XCode: 13.0 beta 3
I have a very basic extension with manifest_version: 3
I tried to convert it through safari-web-extension-converter but it failed to convert with the error unable to parse the manifest.json.
I changed the version to 2 and it worked perfectly.
Is there no compatibility for manifest version 3 extension conversion?
I checked the Assessing Your Safari Web Extension’s Browser Compatibility article, but it had no mentions regarding the manifest version 3 incompatibility.
Is there something else, that I could be missing? and is this documented somewhere else?
My system info:
macOS 11.4 Big Sur
XCode 13.0 beta 3
Thanks
Post not yet marked as solved
The 'Sea Creator' sample app demonstrating Safari Web Extensions first fails to compile, because due to disambiguation extension bundle id isn't prefixed with app bundle id.
When fixed by changed ids the app fails on start, with error saying that the app can't find extension. Regardless, extension works on its own in Safari, but can't communicate with the host app due to aforementioned error.
Post not yet marked as solved
Feedback Assistant case: FB9545798
Installation and running
git clone git@github.com:birchill/10ten-ja-reader.git
cd 10ten-ja-reader
yarn install
npm run build:safari
Now open "xcode13/10ten Japanese Reader.xcodeproj".
For all four build targets, change the developer team to your own developer team.
Run the build target named "10ten Japanese Reader Extension (iOS)" on a real device (mine is an iPhone 11 Pro), selecting the app "Safari" to run the extension for.
Next, on your iPhone, go into Settings > General > Safari > Extensions and allow the extension named "10ten Japanese Reader".
Return to iOS Safari, refresh the current tab (if you want a consistent URL to test on, then let's choose https://ncode.syosetu.com/n4830bu/130/), and check the Share sheet.
Expected results
A Web Extension named "10ten Japanese Reader" or similar should appear in the Safari Share menu. You should be able to enable it, and something that looks like a hockey puck will immediately appear in the bottom-right of the web page.
Actual results
Although I was able to run this Web Extension just fine on iOS 15 beta 5, since updating to iOS 15 beta 6 (and the corresponding latest macOS and Xcode betas available at the time of writing), I have been unable to run the Web Extension. That is to say, it does not appear in the Share menu, even though it appears in Settings > General > Safari > Extensions and is allowed.
I have tried restarting both my Mac and my iPhone, and incrementing the build number, doing clean builds, etc., but nothing has helped.
I see no debug in Xcode that gives any clues, either.
Post not yet marked as solved
Are Safari extensions for iPad OS 15 available yet and if so, how do I get them?
Post not yet marked as solved
Hi!
We're currently building a web extension with iOS as a primary target.
Since haptics on iOS are really nice, we wanted to make use of it to give the experience a special feel on iPhone.
However, haptics don't seem to work when called from SafariWebExtensionHandler... maybe because the messaging layer between the web extension and the native code is in the background (is it?), and haptics don't work in apps that are in the background.
Anyway, is there any way we can make haptics work regardless?
Post not yet marked as solved
How well does Safari iOS15 support web apps. Does the A2HS icon of the progressive WEB APP function offline with no internet. This feature was broken in iOS 14.7. Doug D
Post not yet marked as solved
If someone installs the iOS extension and hasn't enabled it in safari settings, I want to alert/remind them to enable it when they open my website on Safari. So, if the user opens my website, can it detect that the iOS extension if it is already installed?
One of the solutions I tried is to set a cookie or modify content on my website from iOS extension, but without enabling the iOS extension, it is not possible.
Any help would be highly appreciated, thanks for your time!