Safari Services

RSS for tag

Enable web views and services in your app using Safari Services.

Safari Services Documentation

Posts under Safari Services tag

43 Posts
Sort by:
Post not yet marked as solved
5 Replies
1.2k Views
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).
Posted
by
Post not yet marked as solved
18 Replies
2.7k Views
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 .
Posted
by
Post marked as solved
12 Replies
15k Views
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.
Posted
by
Post not yet marked as solved
3 Replies
1.8k Views
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.
Posted
by
Post not yet marked as solved
0 Replies
384 Views
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,
Posted
by
Post not yet marked as solved
0 Replies
330 Views
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
Posted
by
Post not yet marked as solved
6 Replies
1.5k Views
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..
Posted
by
Post not yet marked as solved
0 Replies
316 Views
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?
Posted
by
Post marked as solved
4 Replies
1.2k Views
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,
Posted
by
Post not yet marked as solved
0 Replies
302 Views
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 ?
Posted
by
Post not yet marked as solved
0 Replies
274 Views
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!
Posted
by
Post not yet marked as solved
1 Replies
351 Views
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
Posted
by
Post not yet marked as solved
0 Replies
385 Views
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?
Posted
by
Post not yet marked as solved
2 Replies
864 Views
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
Posted
by
Post not yet marked as solved
0 Replies
559 Views
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.
Posted
by