Display web content in windows and implement browser features using WebKit.

WebKit Documentation

Posts under WebKit tag

283 Posts
Sort by:
Post not yet marked as solved
1 Replies
422 Views
I have been trying to use the WKWebView in my SwiftUI app. To do that, I created a wrapper that allows me to customize my WKWebView. This view should serve a single purpose : I need to grab an authentication token from a callback. That it why I need the last method you can find at the bottom of my CustomWebView class: import Foundation import SwiftUI import WebKit struct WebView : UIViewRepresentable {     let request: URLRequest     func makeUIView(context: Context) -> WKWebView  {         return CustomWebView().webView     }     func updateUIView(_ uiView: WKWebView, context: Context) {         uiView.load(request)     } } class CustomWebView: UIViewController, WKNavigationDelegate { // Create a custom WKWebView that supports Javascript     public let webView: WKWebView = {         let prefs = WKWebpagePreferences()         prefs.allowsContentJavaScript = true         let config = WKWebViewConfiguration()         config.defaultWebpagePreferences = prefs         let webView = WKWebView(frame: .zero, configuration: config)         return webView     }()     override func viewDidLoad() {         super.viewDidLoad()         title = "Sign In"     }     // Grab the authentication token     func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {         guard let url = webView.url else {             return         }         // Exchange the code for the authentication access token         guard let code = URLComponents(string: url.absoluteString)?.queryItems?.first(where: { $0.name == "code" })?.value else {             return         }         print("Code: \(code)")     } } If I don't use this last method, my code runs without any error. But as soon as I run it, the callback loads correctly, but I get multiple errors in the console: 2022-06-21 16:50:17.985187+0200 MyAppsName[39758:7506939] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}> 2022-06-21 16:50:17.985870+0200 MyAppsName[39758:7506939] [ProcessSuspension] 0x1180642a0 - ProcessAssertion: Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=39759, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} I tried to look for specific lines in "Signing & Capabilities" that could unlock any WebKit capabilities, but I can't find anything. Does anyone have a lead?
Posted
by Lyro.
Last updated
.
Post not yet marked as solved
2 Replies
74 Views
Hello! In iPhone 15.5, intermittently, some parts of one page, especially the top area, are covered with something that is not the screen I was working on. And if you scroll, that area disappears and you can see the html areas I coded in the past. how can i solve this?
Posted Last updated
.
Post not yet marked as solved
0 Replies
66 Views
I have one web viewer in React Native for my app, and the function of translate with Google works perfectly in the Safari browser, in my Android App, and on the desktop, but not in the iOS app This is my Google Translate code: function googleTranslateElementInit() { new google.translate.TranslateElement({ pageLanguage: 'pt', includedLanguages: 'pt,en,es', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL }, 'google_translate_element'); comboTranslate = document.querySelector("#google_translate_element .goog-te-combo"); } function changeEvent(el) { if (el.fireEvent) { el.fireEvent('onchange'); } else { // var evObj = document.createEvent("HTMLEvents"); var event = new Event('change'); comboTranslate.dispatchEvent(event); // evObj.initEvent("change", false, true); // el.dispatchEvent(evObj); } } function changeLang(lang) { if (comboTranslate) { comboTranslate.value = lang; changeEvent(comboTranslate); } } function clickChange(){ btn_translate = document.querySelectorAll('.language'); // o que faz os menus acender; btn_translate.forEach(btn =&gt; { btn.addEventListener('click', function (e) { var lang = e.srcElement.getAttribute('data-language'); changeLang(lang) }) }) } clickChange(); setTimeout(() =&gt; { googleTranslateElementInit() // comboTranslate.addEventListener('change', function (e) {alert('a');}) }, 500); and on the app.json I have: { "expo": { "name": "MyApp ", "slug": "MyApp", "version": "1.2.0", "orientation": "portrait", "icon": "./assets/icon.png", "locales": { "en": "./locales/ios/en.json", "pt": "./locales/ios/pt.json", "es": "./locales/ios/es.json" }, "platforms": [ "ios", "android" ], "splash": { "image": "./assets/splash.png", "resizeMode": "contain", "backgroundColor": "#ffffff" }, "plugins": [ [ "expo-notifications", { "icon": "./assets/icon.png", "color": "#ffffff" } ] ], "updates": { "fallbackToCacheTimeout": 0 }, "assetBundlePatterns": [ "**/*" ], "ios": { "buildNumber": "8", "supportsTablet": true, "bundleIdentifier": "com.myapp", "infoPlist": { "CFBundleAllowMixedLocalizations": true } }, "android": { "package": "com.myapp", "versionCode": 9, "googleServicesFile": "./google-services.json", "config": { "googleMaps": { "apiKey": "AIzaSyDQjE4F3chI8Jy4FA8h45LqA7bMfngoH7Y" } }, "permissions": ["ACCESS_COARSE_LOCATION", "ACCESS_FINE_LOCATION", "CAMERA", "RECORD_AUDIO"], "blockedPermissions": ["ACCESS_BACKGROUND_LOCATION"], "adaptiveIcon": { "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#FFFFFF" } }, "notification": { "icon": "./assets/icon.png" } } } I put console.log and alerts to see if the change in the select element of languages is being triggered by the JS, and it's all ok, I really don't know why it is not translating.
Posted Last updated
.
Post not yet marked as solved
1 Replies
45 Views
Hi guys, I search the whole internet and didn't find any reliable solution on how to detect, that our site is opened in WKwebview. Any ideas? Thanks!
Posted
by Svatex.
Last updated
.
Post marked as solved
1 Replies
181 Views
We have some PDFs that were created with JPEG2000 images in them (*.jp2 files). Using PDFKit, and also WebKit, the images in these PDFs in some cases don't display at all, and in others cases appear badly warped. You can view the PDF using either Adobe Reader, or the Chrome app, and the images appear fine, so it's clearly not an issue of a corrupt PDF. Also, 3rd-party commercial iOS controls like PSPDF and FoxIt display the images fine, so it's clearly an issue with PDFKit and WebKit. Any known workarounds?
Posted Last updated
.
Post not yet marked as solved
3 Replies
102 Views
I'm trying to integrate WKWebView to metal rendering pipline and met 2 issues. WKWebView will kick webview rendering only when the WKWebView control is visible, i have been looking around WKWebView related header files and configurations, didn't find a way to force WkWebView render the view for every single frame when the control is invisible or not part of view hierarchy . Low performance when access CGImage pixel data returned from WKWebview takesnapshot, in order to get the pixel data uploaded to MTLTexture i did the following tests: Access the pixel data through CGDataProviderCopyData, the CPU usage is very high, main thread drop to 37 FPS on IPhone 8 Plus simulator, most CPU cycles spend on function vConvert_PermuteChannels_ARGB8888_CV_vec, i also try to render the CGImage to a BitmapContext but still can't get ride of vConvert_PermuteChannels_ARGB8888_CV_vec.       CGDataProviderRef provider = CGImageGetDataProvider(cgImage);       CFDataRef rawData = CGDataProviderCopyData( provider );       CFIndex length = CFDataGetLength( rawData );       UInt8 *buf = (UInt8*) CFDataGetBytePtr( rawData );       MTLRegion region = {         {0, 0, 0},         {1280, 960, 1}       };           [_webviewTexture replaceRegion:region mipmapLevel:0 withBytes:buf bytesPerRow:bytesPerRow];       CFRelease( rawData ); Another try is create metal texture from CGImage via textureLoader but failed with error "image decoding failed"        MTKTextureLoader *loader = [[MTKTextureLoader alloc] initWithDevice: _device];       NSDictionary *textureLoaderOption = @{         MTKTextureLoaderOptionTextureUsage:@(MTLTextureUsageShaderRead),         MTKTextureLoaderOptionTextureStorageMode : @(MTLStorageModePrivate)       };       NSError *error = nil;       _webviewTexture = [ loader newTextureWithCGImage:cgImage options:textureLoaderOption error:&error]; Any idea against how to force kick WebView rendering or more efficient way to access CGImage raw pixel data would be greatly appreciated.
Posted
by Joey_Yu.
Last updated
.
Post not yet marked as solved
2 Replies
394 Views
My Project is dealing WebView with BLE functions. WebView will call native function and retrieve BLE related data. I found that all webviews will be completely blank after sometime and reload doesn't work. I implemented WKNavigationDelegate and found that it stops at func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void and it won't call func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!). I suspected that the networking process is terminated and it won't restart. I have tested it in iOS 12, 14 and 15. only iOS 15 got the issue. It would be great if you could give me some insight about it. Thanks a lot.
Posted Last updated
.
Post not yet marked as solved
0 Replies
53 Views
Hi All! I've encountered an issue/feature that seems weird to me, and I'm unsure where to look for documentation. If I have audio playing from, say, apple music or Spotify. The output volume is briefly lowered when entering a website asking permission to use the microphone. For example, entering a google meet page. I first found this while developing a web app using the Chime SDK and a WebKit Webview, but like mentioned above. It can be reproduced with google meet as well. This leads me to believe it's either connected to asking for microphone permissions or to something in the WebRTC connection. The volume is lowered for internal speakers and an external soundcard. However, if audio is playing from another tab in safari, the audio is not affected. Also, doing the same thing in chrome does not lower the volume. Anyone knows the reason for this. Is it a feature or a bug? Best, Ruben
Posted
by Ruben-elk.
Last updated
.
Post not yet marked as solved
2 Replies
159 Views
Hello Guys, Our application has default web browser entitlement: com.apple.developer.web-browser. However, I am not seeing it in Desktop Safari's Developer menu, I am using iPadOS 16 beta 2(20A5303i), Web Inspector is enabled in Safari's Advanced menu. Do we need to do some additional updates like rebuilding app with Xcode 14 or build that we currently have in AppStore should work without any modifications?
Posted Last updated
.
Post not yet marked as solved
0 Replies
66 Views
here is the code: struct LiveView: View {      @State var allowsInlineMediaPlayback: Bool = false      var body: some View {            VStack {                  VideoView(videoID:"vimeo.com/event/000000/embed")                  }                }            } struct VideoView: UIViewRepresentable {      let videoID: String      func makeUIView(context: Context) -> WKWebView {       let configuration = WKWebViewConfiguration()       configuration.allowsInlineMediaPlayback = true       let WKWebView = WKWebView(frame: .zero, configuration: configuration)       return WKWebView        }      func updateUIView(_ uiView: WKWebView, context: Context) {     guard let youtubeURL = URL(string: "https://\(videoID)") else     {return}     uiView.load(URLRequest (url: youtubeURL))   } } Is their a better way to accomplish feeding a live event link into a playerview instead of needing a WKWebView?
Posted
by TechyGod.
Last updated
.
Post not yet marked as solved
0 Replies
58 Views
Hello, I have used WKWebview inside my tableview cell and given constraint inside my xib file. I am loading html text in webview which i get from server side in api and i have taken webview height constraint property for update height on did finish delegate method. It's not working proper and not giving proper height and on scroll every-time it's rendering with different height. My requirement is i want to display math equations and html content on webview with dynamic height of cell. I have done research and tried everything but it's not working. I am using below code for update webview height. func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {     webView.evaluateJavaScript("document.readyState", completionHandler: { (ready, error) in       if ready != nil {         DispatchQueue.main.asyncAfter(deadline: .now()) {           webView.evaluateJavaScript("document.body.scrollHeight") { [weak self] (result, _) in             guard let self = self, let result = result as? Double else { return }             self.webViewHeightConstraint.constant = CGFloat(result)             self.webView.updateConstraints()            }         }       }     })   }     Please help me to solve this issue. Thank you
Posted
by hitler48.
Last updated
.
Post not yet marked as solved
0 Replies
55 Views
I am trying to set and maintain the zoomScale value on the scrollView associated with a WKWebView. I can set the value without issue. I have noticed, however, that when the size of the webpage changes (due to a change in content), the zoomScale gets reset back to 1. Also, this reset behavior does not occur if the zoomScale is set via a pinch gesture by the user. Is there something I can do to maintain the programmatically set zoomScale when the size of the web page changes?
Posted Last updated
.
Post not yet marked as solved
1 Replies
2.6k Views
I can debug WKwebview's js content with Safari inspector when I run the project into a real device, but Safari can't find any inspectable appliction when I try to debug the archived app that has been set to be debug. By the Way, I have set the deivce's Web inspector enable.
Posted Last updated
.
Post not yet marked as solved
1 Replies
80 Views
Hello, We are running a complex web application built with React and related ecosystem. this web application is essentially a PWA and it is offline first. So, It relies heavily on service worker, indexDB database, cache storage, local storage etc. We are running this web application inside a WKWebView which resides in a native iOS App. We have noticed that WKWebView is highly unreliable when it is running such a complex web app. some of the behaviours noticed are only blank screen is shown with no content loaded from the url when url is pointed to different location (say uat, qa, prod environments) in the same wkwebview at run time, it causes data corruption as part of indexdb. it seems that it is not keeping different sets of data for different urls. when registering newer version of service workers, wkwebview errors out and can not proceed with new registrations does not always show a target page when a react app programmatically navigates to different locations within the web app. I am interested in knowing from fellow iOS developers that have you previously experienced above with WKWebView? is WKWebView a good option for running such a web application or SFSafariView is the better alternative? thank you Dilip
Posted Last updated
.
Post not yet marked as solved
0 Replies
74 Views
Hello, I work for Holding Group company, and they plan to publish an application which is only a webView. I know the webView apps get rejected, but the case here is that this application is the internal app "For enterprise company." Also, I want to know if the app reviewing process is also applied on the Enterprise level or if it is only for the individual users Kind regards
Posted Last updated
.
Post not yet marked as solved
0 Replies
80 Views
I have a function where user can open webpage in inappbrowser and make payment there. I get this error as below when user want to make payment. My apps have no issue when launch webpage, but when user click to pay and payment gateway call selected bank url, inappbrowser suddenly closed. android is working fine but having problem only in ios. I already update webview to latest version and enable ATS.. but didnt working at all. this is a critical bugs since my users unable to make payments for now. Please help me. thank you Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} ProcessAssertion: Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=5315, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} ProcessAssertion: Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=5315, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
Posted
by Nurraysa.
Last updated
.
Post not yet marked as solved
2 Replies
506 Views
I have a memory leak on WebKit, and profiling through Xcode instruments gives a memory leak on the following. WKHoverPlatter 1 0x281e7f7e0 96 Bytes WebKit -[WKContentView(WKInteraction) setUpInteraction] Would anyone know how to fix this? Here is my sample test code : var webView: WKWebView! override func loadView() {         let webConfiguration = WKWebViewConfiguration()         webView = WKWebView(frame: .zero, configuration: webConfiguration)         webView.uiDelegate = self         view = webView } override func viewDidLoad() { super.viewDidLoad()         let myURL = URL(string:"https://www.apple.com")         let myRequest = URLRequest(url: myURL!)         webView.load(myRequest) }
Posted
by kalita22.
Last updated
.
Post not yet marked as solved
0 Replies
76 Views
I'm trying to upload a binary file from iOS to a server on local Wifi. The uploader on the server works fine from its web page, but I can't get it to upload from Swift. It looks to me like my request is not properly formed, but I haven't been able to figure out what it's missing. Thanks for any help. ~ Nancy Here's my upload routine:    func uploadFile() {     let config = URLSessionConfiguration.default         let session = URLSession(configuration: config)     let updateURL = URL(string: ("http://" + currentBaseString + "/update"))     var request = URLRequest(url: updateURL!)     print("SETUP Upload Request: ", request)     request.httpMethod = "POST"     guard let fileURL = Bundle.main.url(forResource: "R2-0701", withExtension: "bin") else {       print("Failed to create URL for file.")       return     }     do {       let data = try Data(contentsOf: fileURL)       print("SETUP Found the data file\n")       request.httpBody = data       let task = URLSession.shared.uploadTask(with: request as URLRequest, fromFile: fileURL) { data, response, error in         if error != nil {           print ("RRC Task error: \(String(describing: error))")           return         }         guard let response = response as? HTTPURLResponse, (200...299).contains(response.statusCode) else {           print ("Server error")           return         }         if let mimeType = response.mimeType,           mimeType == "multipart/form-data",           let updateData = data,           let dataString = String(data: updateData, encoding: .utf8) {           print ("got data: \(dataString)")         }       }       task.resume()     }     catch {       print("Error opening file: \(error)")     }   } My URL construction is fine, it works for GET requests. "R2-0701.bin" is the filename of a file added to the project. Here's the server HTML: <script src='https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'> </script> <form method='POST' action='#' enctype='multipart/form-data' id='upload_form'> <table cellpadding = '10' align='center''> <tr> <td bgcolor='AA0000' align='center' style='color:white;'> <p font-color='white' text-size='12' > <b>Reprogram</b> </p> </td> </tr> <tr> <td> <input type='file' name='update'> </td> </tr> <tr> <td align='center'> <input type='submit' value='Update'> </form> </td> </tr> <tr> <td align='center'> <div id='prg'>progress: 0%</div> </td> </tr> </table> <script> $('form').submit(function(e){ e.preventDefault(); var form = $('#upload_form')[0]; var data = new FormData(form); $.ajax({ url: '/update', type: 'POST', data: data, contentType: false, processData:false, xhr: function() { var xhr = new window.XMLHttpRequest(); xhr.upload.addEventListener('progress', function(evt) { if (evt.lengthComputable) { var per = evt.loaded / evt.total; $('#prg').html('progress: ' + Math.round(per*100) + '%'); } }, false); return xhr; }, success:function(d, s) { console.log('success!') }, error: function (a, b, c) { } }); }); </script>; Here's the output: SETUP Upload Request: http://192.168.86.41/update SETUP Found the data file 2022-07-04 17:21:52.075958-0600 RoadrunnerComfort[5034:11127394] Task <25F2EC07-30D7-4532-BD6A-D35A41716AF2>.<7> HTTP load failed, 1048855/0 bytes (error code: -1005 [4:-4]) 2022-07-04 17:21:52.082677-0600 RoadrunnerComfort[5034:11127423] Task <25F2EC07-30D7-4532-BD6A-D35A41716AF2>.<7> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x283fb49c0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x2812ecc80 [0x22eb841b8]>{length = 16, capacity = 16, bytes = 0x10020050c0a856290000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask <25F2EC07-30D7-4532-BD6A-D35A41716AF2>.<7>, _NSURLErrorRelatedURLSessionTaskErrorKey=(   "LocalUploadTask <25F2EC07-30D7-4532-BD6A-D35A41716AF2>.<7>" ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=http://192.168.86.41/update, NSErrorFailingURLKey=http://192.168.86.41/update, _kCFStreamErrorDomainKey=4} 2022-07-04 17:21:52.083212-0600 RoadrunnerComfort[5034:11127396] [tcp] tcp_input [C7:2] flags=[R.] seq=3409008496, ack=2962928595, win=5744 state=LAST_ACK rcv_nxt=3409008496, snd_una=2962927159 RRC Task error: Optional(Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x283fb49c0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x2812ecc80 [0x22eb841b8]>{length = 16, capacity = 16, bytes = 0x10020050c0a856290000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask <25F2EC07-30D7-4532-BD6A-D35A41716AF2>.<7>, _NSURLErrorRelatedURLSessionTaskErrorKey=(   "LocalUploadTask <25F2EC07-30D7-4532-BD6A-D35A41716AF2>.<7>" ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=http://192.168.86.41/update, NSErrorFailingURLKey=http://192.168.86.41/update, _kCFStreamErrorDomainKey=4})`
Posted Last updated
.
Post not yet marked as solved
1 Replies
943 Views
We have created a sample HTML page with service worker to enable offline load for iOS 15, And we are loading the sample HTML page in IOS Sample App . Sample app contains the WKWebview(which is webkit framework) which loads the sample HTML. we have added the app bound domain in the Info.plist to support the Service Worker. AppBoundDomains in Info.plist is <key>WKAppBoundDomains</key> <array> <string>https://ottapp-appgw-client.dev.mr.tv3cloud.com</string> </array> And configured the WKWebViewConfiguration for WKWebView through code: if (@available(iOS 14.0, *)) { configuration.limitsNavigationsToAppBoundDomains = YES; } Working Scenario is : When we launch the application in online mode for the first time, it is successfully registering the ServiceWorker. On launching the application in offline mode, it successfully loads the offline page in iOS 15. Issue is : After repeatedly killing and relaunching the application many time (say 5-6 times), we are seeing the blank screen instead of loading the offline page (which is Service Worker Enabled) we are receiving the below error when service worker is not working: [Process] 0x10581f018 - [pageProxyID=5, webPageID=6, PID=8803] WebPageProxy::didFailProvisionalLoadForFrame: frameID=3, domain=NSURLErrorDomain, code=-1009 2022-03-21 19:32:40.651305+0530 WKWebViewSample[8800:1490156] didFailProvisionalNavigation Issue Repro rate 5 Out of 10 Added the logs for the same WKWebView Service Worker Issue - Ios 15.txt working and non working logs from IOS
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.7k Views
It seems to be a question that comes up often in different ways, but despite several hours of research I still haven't found a solution. I currently face an issue in Safari 14 on MacOS BigSur where cookies are never sent by Safari on XmlHttpRequests to an api on the same root domain. Indeed, i'm working on an Angular SPA where the client app is locally hosted at https://myapp.local and for tests purpose I have an api running locally on https://api.myapp.local. For some requests, we need to attach 2 cookies that are originally set by the API. I am able to see the said cookies in the API responses and in the "storage" section of Safari's DevTools, however they are never sent back to the server for subsequent XHR requests. (XHR with credentials) I did try different cookie's attributes but none of my tries were successful : sameSite=None, domain=myapp.local, Secure, httpOnly sameSite=Lax, domain=myapp.local, Secure, httpOnly The only way I found to get around the problem was to disable the "prevent cross-site tracking" option in Safari's privacy settings (which is not a proper solution for our users since this option is enabled by default...) Nevertheless, I don't understand why Safari consider those cookies as 3rd party cookies (and blocks them) since the API is hosted on the same domain (on a subdomain to be more accurate) than the client web app. And, if I understood correctly, cookies should be sent by browsers for subdomains requests, both with sameSite=Lax and sameSite=None. Especially since it works perfectly on Firefox and Chromium browsers. Anyway, if anyone has an idea or a solution I would be very interested to hear it because I don't know what to try anymore! Thanks a lot !
Posted
by obrassard.
Last updated
.