Post not yet marked as solved
Currently, if a page csp disallows inline scripts, but the content script attempts implant inline scripts (DOM injected scripts) - the code will fail to execute.
This is an issue with the current Safari extension model. The effect of this is that content scripts that inject dynamic (user-generated) content can not properly interact with the page context.
This is also an issue with other major browsers, however I do not believe Chrome has this restriction. The reason I say "do not believe" is because the documentation indicates that "page csp does not apply to content scripts", but I have not personally tested this.
I'd like to know is this restriction will be present with the new Safari WebExtension model, especially considering that webRequestBlocking is not supported (which would be the only workaround I am aware of).
Post not yet marked as solved
Hey Everyone,
I’m developing PWA for one project and i found that after update (13.6) on every phone i tested (iPhone 7 plus , iphone Max Pro , PWA Application freeze.
Freeze Mode : Open App
Go to home screen wait 5-10 seconds
Reopen app
If i go to home screen second time and then again return to app it starts working , no console errors .
please help .
service worker with / without has no effect .
Post not yet marked as solved
Hello,
I am in the process of converting a Web Extension to a Safari Extension. I need to use browser.downloads.onCreated.addListener in my extension but the browser.downloads API is not supported yet.
Do I have another way to do that?
Hello,
Is anyone else getting an error message like this,
Safari could not open the page because the server stopped responding
It suddenly stopped working after I clicked on the option to close all my tabs and refreshed the application.
I am unable to browse anything. The internet side of things seem to be working fine. Pretty sure its a Safari issue.
Post not yet marked as solved
Hi
I have installed IOS 15 beta and have problem with safari.
The problem occurred when I closed one of the browser tabs, but when I turned on safari again, this tab came back.
after I closed this tab a few times, the safari stopped working and I couldn't even turn on safari.
When i click on the safari icon it won't turn on, it looks like i was opening and closing applications immediately safari before it loads.
Post not yet marked as solved
Hi, I've been scratching my head for few days for the same problem I'm having.
When I initially tab into my web-app, the bottom tab bar renders beautifully, with the bottom 0px and height of 64px.
But the issue occurs when I leave the app and re-enter after few seconds, suddenly the tab bar container gets shrink down from where I expected to be leaving a horror gray area.
On Android shows no problem but with iPhone-which I think is because of Safari iOS bottom navigator-the bottom: 0px, doesn't get the right layout.
I'm attaching pictures to describe what I'm going through.
There's one more weird part. I have several other apps which basically has same code line, front-end and back-end, but only two of them seem to show the same bug.
Is this something to do with the native? Would appreciate any suggestions! Thank you,
Post not yet marked as solved
In iOS 15 beta 8, Safari/WKWebView autherize/cancel buttons shown as white box.
On click it is shown the text in blank but still filled colour is white
Post not yet marked as solved
I'm experiencing an intermittent bug with Auto Layout in the popover for Safari App Extensions.
It appears that any resizing in the view controller sometimes happens before the window itself is resized, and this has a very odd appearance. I'd like to figure out how to stop this from happening.
I've tried moving any constraint changes into the updateConstraints method as suggested in AppKit resources I've found, however the bug remains.
For reference, here are the collapsed and expanded views:
Here are the intermediate frames that I'd like to prevent:
This is the function that toggles the constraints to show/hide the long text:
@objc private func toggleContent(_ sender: NSButton) {
if longText.isDescendant(of: contentView) {
contentButton.title = "Show text"
// Remove text
longText.removeFromSuperview()
initialBottomConstraint.isActive = true
} else {
// Add text
contentButton.title = "Hide text"
initialBottomConstraint.isActive = false
longText.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview(longText)
NSLayoutConstraint.activate([
longText.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16.0),
longText.topAnchor.constraint(equalTo: contentButton.bottomAnchor, constant: 16.0),
longText.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -16.0),
longText.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -16.0)
])
}
}
Edit: for screenshot size
Post not yet marked as solved
Hello there!
After update of iOS15 quick-look does not work properly with SafariServices that we use on our native web.
For example; if you open this link on twitter https://developer.apple.com/augmented-reality/quick-look/
just click model to use quick-look, you will see AR part is not working..
Post not yet marked as solved
I'm using SFSafariViewController for load weblinks,
In my case first I need to open one URL after some process/time(like 10 sec) I need to update my URL in the same tab and refresh SFSafariViewController.
if let url = URL(string: "Google.com") {
let VC= SFSafariViewController(url: url)
VC.delegate = self
self.present(VC, animated: true, completion: nil)
}
There is any way to update The URL and refresh the current SFSafariViewController page?
Post not yet marked as solved
in one secound seen that in one of the tab showing facebook.com webpage.
Tried all the solution on internet forum, but unable to over come.
please do share file system solution or new app.
Hi everyone:
How all we know the use of App-Prefs:root is a headache, because it causes rejection in AppStore, because it's considered that root and following is a private API. The app-settings: scheme redirect to our app settings, and that's not the behaviour expected
@eskimo what about only use App-Prefs:? Is it considered private API? Is it not an app scheme?
We have a lot of issues open by users because the mobileconfig download, since iOS 12.2 from Safari, not redirect the user to the profile settings.
Users complain because of it, and maybe with the simple fact of could open settings not our app settings, the settings app could solve the problem because of the iOS Bug is not resolved nowadays.
Thanks for all,
Best regards,
Post not yet marked as solved
Where can I find sample codes and some api listing for iOS only?
Post not yet marked as solved
do we have settings for changing search provider through extension on latest iOS 15?
Post not yet marked as solved
Hello,
I have use Safari content blocker extension on Mac Catalyst application.
Here is the code for reloadContentBlocker
// Config.BLOCKER_EXTENSION = Content blocker extension bundle identifier
func reloadBlockerRules() {
if #available(macCatalyst 13.4, *) {
SFContentBlockerManager.reloadContentBlocker(withIdentifier: Config.BLOCKER_EXTENSION, completionHandler: { error in
if error != nil {
TextLog.shared.write("RELOAD OF \(Config.BLOCKER_EXTENSION) FAILED WITH ERROR -\(error?.localizedDescription ?? "")")
}
})
} else {
// Fallback on earlier versions
TextLog.shared.write("Fallback on earlier versions - reloadBlockerRules")
}
}
I have reload the blocker rules on application startup but its cashing every time with following reason :
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSXPCInterfaceProxy_SafariExtensionHelperProtocol loadContentBlockerWithIdentifier:sandboxExtensionToken:invokedBySafariFamily:reply:]: unrecognized selector sent to instance 0x6000012ac370'
terminating with uncaught exception of type NSException
abort() called
Can you please help me out for find the crash reason ?
Post not yet marked as solved
I'm building an app that can present a web page via SFSafariViewController. However, I found that when opening a web page (powered by SFSafariViewController) for which there is an iOS app installed, the smart app banner doesn't show up (https://ibb.co/B3mNS0c) so there is no way to segue from the page to the app. I checked the same page loaded directly on Safari iOS app, the banner indeed shows up https://ibb.co/xmw7vDy.
Does anyone know how I can enable the banner for the page presented within my app? Thanks!
Post not yet marked as solved
Hello guys,
I am currently working on a safari app extension that blocks content. I want the user to configure the rule (turning a rule on and off). Since I can’t overwrite the bundled JSON files and we can’t write to the documents folder, as it’s not accessible to the extension I decided to use App Groups. My approach looks like this:
Within the ContentBlockerRequestHandler I want to save the blockerList.json into the app group (Only when launched for the first time)
When this is done I want that the handler reads from the app group by taking the url of my json which is within the app group instead of taking the default json in the extension
Since I can not debug the handler I don't know if I am on the right path. The following shows my code:
/ /
class ContentBlockerRequestHandler: NSObject, NSExtensionRequestHandling {
func beginRequest(with context: NSExtensionContext) {
guard let rulesUrl = loadRules() else {
let clonedRules = cloneBlockerList()
save(rules: clonedRules)
return
}
guard let attachment = NSItemProvider(contentsOf: rulesUrl) else { return }
// let attachment = NSItemProvider(contentsOf: Bundle.main.url(forResource: "blockerList", withExtension: "json"))!
let item = NSExtensionItem()
item.attachments = [attachment]
context.completeRequest(returningItems: [item], completionHandler: nil)
}
private func cloneBlockerList() -> [Rule] {
var rules: [Rule] = []
if let url = Bundle.main.url(forResource: "blockerList", withExtension: "json") {
do {
let data = try Data(contentsOf: url)
let decoder = JSONDecoder()
let jsonData = try decoder.decode(ResponseData.self, from: data)
rules = jsonData.rules
} catch {
print("error:(error)")
}
}
return rules
}
private func save(rules: [Rule]) {
let documentsDirectory = FileManager().containerURL(forSecurityApplicationGroupIdentifier: "my group identifier")
let archiveURL = documentsDirectory?.appendingPathComponent("rules.json")
let encoder = JSONEncoder()
if let dataToSave = try? encoder.encode(rules) {
do {
try dataToSave.write(to: archiveURL!)
} catch {
// TODO: ("Error: Can't save Counters")
return;
}
}
}
private func loadRules() -> URL? {
let documentFolder = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "my group identifier")
guard let jsonURL = documentFolder?.appendingPathComponent("rules.json") else {
return nil
}
return jsonURL
}
}
Thankful for any help
Post not yet marked as solved
This documentation guide and the corresponding demo project show how the the Web Extension Handler can inherit from NSExtensionRequesetHandling and implement beginRequest to receive and reply to messages sent from the background script via browser.runtime.sendMessage().
The guide also mentions how browser.runtime.connectNative and SFSafariApplication.dispatchMessage can be used to send messages from the Handler to the background script, but the code is not in the example project.
Further, it seems that SFSafariApplication is not available on iOS.
How can I send a message originating from the Extension Handler to notify the background script of events coming from native code (e.g. UserDefaults changes)? Is polling from the background script the only option?
Post not yet marked as solved
I'm developing Safari App Extension for iOS 15.0+ and I need to get URL of active tab in popup.js and display.
Here is how I do that in popup.js:
document.getElementById("activetaburl").innerHTML = document.URL
As result it returns path of current popup.js
Here is my permissions from manifest.json:
"permissions": ["nativeMessaging", "activeTab"]
And info.plist:
<dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict> <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer> <key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>10</integer>
</dict>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.Safari.web-extension</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler</string>
</dict>
</dict>
So how to fix the issue above and get url of active tab?
Thanks,
Serge
Post not yet marked as solved
Apple Team - Need URGENt help with iOS 15.1.1 Safari.
Local Video Media Stream is blank with no audio when we run webRTC app over KMS servers in safari iOS 15.1.1
Some of the experimental settings of Safari are causing the issue and we donno which one.
There is no error reported either on console or during media exchange.
We heard this is an issue with many of the WebRTC + Media Server apps . Request urgent attention and help.
Thank You.