Explore the integration of web technologies within your app. Discuss building web-based apps, leveraging Safari functionalities, and integrating with web services.

General Documentation

Post

Replies

Boosts

Views

Activity

chrome extension converted to safari, chrome.runtime.sendMessage does not work on iOS
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?
0
0
522
Dec ’23
Updating Safari content blocker from daemon
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!
2
1
535
Dec ’23
Animated AVIF is rendered slowly on Safari
Animated AVIF is rendered slowly on Safari Tested with MacBook pro (16" 2019) and Safari (Version 17.0 - 19616.1.27.211.1) and also on several iPhone models (14, 15 Pro) (over BrowserStack) When using macBook pro (16" 2019) with Chrome (Version 120.0.6099.129) it is rendered OK example for 720p@25FPS: https://res.cloudinary.com/yaronshmueli/image/upload/cases/animated_AVIF_Apple/world_flight_fast_decode_tile_clmn_btiolg.avif
1
2
897
Dec ’23
WebXR Mixed Reality Supported in Safari Vision OS?
I understand that fully immersive experiences, Quicklook using USDZ, and the newly adopted element tag for 3D objects are all supported in WebXR in Safari on Vision OS. What about Mixed Reality in WebXR? Meaning augmented reality experiences seen using passthrough on the apple vision pro where you can see your environment in combination with the webXR experience. (not fully immersive) Can you run full webXR experiences in passthrough mode? Or just view 3D models.
4
2
985
Dec ’23
WebSocket connection failed while sending 10KB binary data
Hello, I'm creating a WebSocket connection to my server from the safari browser via console tab like below. let socket = new WebSocket('wss://localhost:1200/WS_TEST?client=123&session=1234'); socket.onopen = function (event) { console.log('WebSocket connection opened:', event); }; socket.onmessage = function (event) { console.log('Received buffer', event.data); }; Once the connection established, The server sends multiple data which includes text and binary data. When the server sends binary data more than 10KB after sending text data in the same socket, the WebSocket connection is getting failed. EX: Frame Type(Text): "Hi" Frame Type(Binary): just binary frame of size 11KB When the server send the binary data alone, the connection is not affected even the size is more than 100KBs EX: Frame Type(Binary): just binary frame of size 100KB
1
0
397
Jan ’24
Add to apple calendar is not working react PWA app on iPhone
Add to apple calendar is not working react PWA app on iPhone I have developed react PWA app reactjs - v16.14.0 and testing in my iphone13. I have used **npm library ** which opens google,outlook, apple calender event properly on android device, on IOS google and outlook works fine but add to apple calendar event doesnt not show any popup or not showing any error. I have reported one issue on this library forum but they have mentioned that Apple blocks the dynamic generation of ics files I am looking for resolution for this. Let me know proper way to add event in apple calender considering javascript library. [Edited by Moderator]
0
0
920
Jan ’24
Safari not loading web fonts in web worker due to same-origin fetch mode
I am developing an app that uses a Web Worker to render on a canvas, using transferControlToOffscreen(). I need to load web fonts into the canvas for rendering some text, but they are not loading in Safari (testing on Mac). I get the error : Cannot load https://fonts.gstatic.com/s/zillaslab/v11/dFa5ZfeM_74wlPZtksIFYuUe6HOpW3pwfa0.woff2. Failed to load resource: Cross origin requests are not allowed when using same-origin fetch mode. This works fine in Chrome and Firefox. The fonts return the "Access-Control-Allow-Origin" correctly, but in Safari the call isn't even made in order to check the access-control. Is there a way to get Safari to make these requests and honor the access-control returned in the header for the font? If not, is there a suggested work around in order to load web-fonts in a Worker context?
1
0
647
Jan ’24
Need Help with Error message on Visual Studio Code
Beginning to Learn C++ in school, Just trying to figure out why my program version is saying this? I am a student in school and am learning Visual Studio Code because that's the only way to use C++ anyways I put in a basic code and I'm getting this error message. I have included my code and then the error response. Can anyone tell me what went wrong? I feel like it should be all legit... #include using namespace std; int main() { cout << "welcome to C++!"; return 0; } Error Response Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
2
0
366
Jan ’24
How to reset the CookieAcceptPolicy setting for NSHTTPCookieStorage.
I made a change to the CookieAcceptPolicy in NSHTTPCookieStorage in my app: [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyNever]; When I use the following code to restore its settings: [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain]; WKWebView still does not store cookies. I found that in iOS 17, the cookie policy for WKWebView can be enabled through the following configuration: [[[WKWebsiteDataStore defaultDataStore] httpCookieStore] setCookiePolicy:WKCookiePolicyAllow completionHandler:^{}]; But how can this be done in versions prior to iOS 17?
0
0
287
Jan ’24
Using Apple Push Notifications Console with Safari Web Push?
I'm using standard Safari Web Push, but my notifications aren't coming through. I'm trying to debug this. Is it possible to use the Apple Push Notifications Console to debug/analyze Safari Web Push deliverability? I can't figure out how to use it for web push. When I login and try to use the Push Notification Console, it asks me to choose an "app." But for standard Safari 16+ Web Push, there is no "app," no "Website Push ID", etc. that I register with Apple. So how can I use the Push Notification Console for this? Apple's documentation does strongly imply that it should work. Sending web push notifications in web apps and browsers: To resolve an error, address the issue and resend your push notification request. For more information about the factors that impact the delivery of a push notification, see Viewing the status of push notifications using Metrics and APNs. And that page is all about the Push Notification Console. So it must be possible somehow, right?
0
0
627
Jan ’24
about fonts
I'm developing a website. When I write font-family: system-ui,PingFang SC in css, I understand that there is no risk of infringement. Can you confirm it for me? At the same time, what I'm not sure about is if I take screenshots on my website, are there any risks in terms of copyright infringement? Looking forward to your reply
1
0
383
Jan ’24
Strange reload behavior, WKWebView reloads with returnCacheDataElseLoad after background
Hi, in our app we have a WKWebView with complex web content that is loaded with cachePolicy: .reloadIgnoringLocalCacheData. If the app is in the background for several hours and returns in the foreground we noticed that the system reloads the webpage, but it does so with a cachePoliy returnCacheDataElseLoad. This could break the app if older cache content is present. To reproduce start an app in the simulator (tested with iOS 17.2), put it in the background and via activity monitor stop the processes com.apple.Webkit.WebContent com.apple.Webkit.networking After foreground the reload will happen. Two questions: why is this reload happening after some hours in the background? We haven't seen any crash reports related to this. It mostly happens on one of our test devices (iphone13 with iOS17.2.1). why is the webview reloading with a modified cachePolicy (returnCacheDataElseLoad)? Our temporary fix is to detect this case in "webView:decidePolicyFor navigationAction decisionHandler", cancel the request and reload with modified cachePolicy. Any ideas? Thanks, Heiko Sample code: class ViewController: UIViewController, WKNavigationDelegate, WKUIDelegate { var webView: WKWebView! override func viewDidLoad() { super.viewDidLoad() let config = WKWebViewConfiguration() webView = WKWebView(frame: .zero, configuration: config) webView.uiDelegate = self webView.navigationDelegate = self view.addSubview(webView) let myRequest = URLRequest(url: URL(string: "https://www.apple.com")!, cachePolicy: .reloadIgnoringLocalCacheData) print("request \(myRequest)") webView.load(myRequest) } func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { print("start loading \(String(describing: navigationAction.request.url)), cache:\(navigationAction.request.cachePolicy)") decisionHandler(.allow) } override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() let fullscreen = CGRect.init(x: 0, y: 0, width: view.frame.size.width, height: view.frame.size.height) webView.frame = fullscreen } }
2
1
1k
Jan ’24
revert-layer within inline styles
Although CanIUse reports only 3% global support for the revert-layer keyword, I've noticed that it seems to work pretty consistently within inline styles (i.e. the style attribute). This got me thinking (hoping) that maybe browser support for revert-layer specifically within inline styles may be much better than reported. However, it's difficult to find any data since I suppose my use case is somewhat uncommon. Can anyone comment on the state of Safari's support for revert-layer specifically within inline styles? I would be extremely grateful for any light you can shed on this.
0
0
547
Jan ’24
Possible issues with Websockets in Safari 17?
Hi, we have a WebRTC application web application in which our video freezes in Safari 17 (no other browsers or earlier Safari). Our application also uses js Websockets as part of signalling protocols. We seem to get video freezing when we establish and send data over one of these websockets. We have seen various posts online about websocket fragmentation bugs causing ESP (?) issues with the new NSURLSession Websocket implementation, but don't see any resolution (nor how in Safari 17 if we can switch back to a legacy websocket implementation). Additionally, we don't appear to have problems with one of our APIs, which differs in the 'problematic' one in that it uses a Websocket with a 'binaryType' defaulted to 'Blob', whereas our troublesome one sets the binary type to 'arraybuffer'. I saw that the Safari 17 release notes mentions 'Fixed WebSocket’s binaryType setter to not throw. (109192086)' but, again, I can't find any further detail and whether this means that there are still issues with Safari 17 Websocket binaryType? Obviously, we will try changing our implementation to use 'Blob' and see if this makes a difference, but it would be useful to know if anyone has had any similar issues with Safari 17????? Kind regards, Mike
1
1
890
Jan ’24
Safari keeps logging me out of websites
It started happening about 6 months ago, I'm using the latest Safari Version 17.2.1 (19617.1.17.11.12) Below are my privacy settings I've tried creating a new user on the Mac and using that, and still does it. I've tried resetting all developer settings on the browser and still does it. It's quite frustrating as I keep losing my work, specially on Shopify, I hit save and the browser is logged out. I need a solution for this, there are posts here from years ago of people with similar issue and no solution from Apple.
4
1
1.1k
Jan ’24
navigator.mediaDevices.getUserMedia OverconstrainedError on Safari in IOS17
When javaScript calls to navigator.mediaDevices.getUserMedia using {video: true, audio: true } constraints, throws an error: error: OverconstrainedError constraint: "" message: "Invalid constraint" name: "OverconstrainedError" Same result when constraints has video: true and audio: false You can test it easily opening the webRTC github samples: https://webrtc.github.io/samples/src/content/devices/multi/ https://webrtc.github.io/samples/src/content/getusermedia/gum/ This works fine on IOS16
0
0
798
Jan ’24
"Google pay button icon" not visible in specific iOS versions
Hi, The below code is used for loading GPay icon dynamically from Google in "WKWebView". The same code works for later versions of IOS like 16.4, but issue happens in 16.1 ,16.2 and 16.3 versions. while loading this code from IOS 16.3 the icon (Gpay icon) is completely black, looks like it's not loaded properly. Please assist us on what can be the issue, and how we can proceed to solve the issue. Not working Working
0
0
687
Jan ’24
How can I add "WebKit uploads"?
0x60700003ab00 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebKit uploads' for process with PID=56268, error: Error Domain=RBSServiceErrorDomain Code=1 "originator doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=originator doesn't have entitlement com.apple.runningboard.assertions.webkit} Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "originator doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=originator doesn't have entitlement com.apple.runningboard.assertions.webkit}> The above error occurs. What should I do?
0
0
410
Jan ’24