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

All subtopics
Posts under Safari & Web topic

Post

Replies

Boosts

Views

Activity

Iframe LocalStorage is Lost when opening a new window
I have a homepage with an iframe containing my app LocalStorage, but when opening my app page the LocalStorage is lost. structuration of the page: homepage : domain.com iframe and app : app.domain.com the localstorage is set up directly within the iframe and postmessage between iframe and parent works. We see in the parent page that the LocalStorage for the sub-domain is set but opening the sub-domain on a new window it disappears : The problem is detected On Safari 18 only.
0
0
687
Oct ’24
SFSafariApplication.dispatchMessage on xcode 16
Hello, We have a Safari extension in the app store for about two years. Our extension relies on syncing the data available in a desktop application to the extension. For this we always used SFSafariApplication.dispatchMessage to sync the data without the extension requesting it. And it used to work just fine. Now it appears that dispatchMessage is being marked as unavailable to extensions, so now xcode 16 is failing to build the extension. Also the documentation (Send messages from the app to JavaScript) still indicates that we can use dispatchMessage to initiate communication from the mac os app. Is there a way to achieve this as it is required for our extension to function, and that's how we have built it for chrome and firefox (one codebase).
1
0
419
Dec ’24
Issue with Safari and webserver with unencrypted HTTP traffic
We seem to be having an issue with a webservice here which is used within our network and IOS Safari. For the service to work , we need to access it with an unencrypted HTTP API call, which acts as a trigger. The server does not respond to HTTPS requests. (the HTTP API call does not contain any data that is privacy sensitive or that can be abused) Since recently the service does not seem to work anymore properly, but this only happens with Safari and IOS. With all other browsers the service is still working normally, only with Safarai it fails. No matter what I do in the settings of the phone, the Safar browser seems to stop immediately after the HTTP request. What is going on here ?? The issue seems to occur only when you don't have an iCloud+ account. With an iCloud+ account I get the same issue when you switch Apple Private Relay on, but that make sense. When I have Apple Private Relay switched off, there is no issue.
Topic: Safari & Web SubTopic: General
0
0
142
Feb ’25
Private Web Certificate issue with iOS 18
We currently are using private web security certificates for our URLs. Our users download, install, and enable a Root Certificate on their devices to reach our website (trusted). The web security certificates have expirations that are less than 13 months from expiration. Since the deployment of iOS 18, our users are now getting a "This Connection is not Private" warning in the web browser on both Mac and iOS devices. What change was implemented in iOS 18 that is causing this issue? Other than changing our web security certificates to Public ones, what solutions should be implemented to prevent this from occurring?
0
0
477
Oct ’24
Camara preview High probability failed on iOS17.5
When using WKWebview to load the following url on iOS17.5, The Camara preview page is likely to not display the image, but there is no error report. The video cannot be loaded. There is no problem with iOS17 and iOS18. I can't find the cause of the error, How to avoid this problem? I hope you can provide some suggestions. I want a way to avoid the error,Thanks STEPS TO REPRODUCE Run iOSTest.xcodeproj on iOS17.5 Tap WKWebview(Camara) Waiting webview load url tap 手持设备训练 立即开始 download demo https://github.com/xuty/Report22/raw/refs/heads/main/iOSTest_1_url.zip
Topic: Safari & Web SubTopic: General
0
0
249
Jan ’25
[MapkitJS] Uncaught TypeError: [MapKit] Expected a number for `x` in MapRect constructor but got `NaN` instead.
Hi, I'm building a nextjs app based on of MapkitJS. I tried to pass a new value to cameraZoomRange like the code below. As long as I put in this part map.cameraZoomRange, the error shows up. Not sure it's my fault, or the bug of MapkitJS. const map = new window.mapkit.Map(element, { colorScheme: mqMatchLightTheme ? window.mapkit.Map.ColorSchemes.Light : window.mapkit.Map.ColorSchemes.Dark, showsCompass: window.mapkit.FeatureVisibility.Hidden, showsMapTypeControl: false, showsZoomControl: false, showsUserLocation: true, tracksUserLocation: true, isRotationEnabled: true, isZoomEnabled: true, }); map.cameraZoomRange = new window.mapkit.CameraZoomRange({ minCameraDistance: 14, maxCameraDistance: Infinity, });
1
0
560
Oct ’24
MacのSafariをseleniumからiosのユーザーエージェントで起動したい
タイトルの通り,seleniumからsafariを起動して操作したいのですが,ユーザーエージェントの変更ができずにおります. ご存知の方は解決方法をご教示いただけますと幸いです. 以下はChromeで操作するためのコードですが,これと同等のことをSafariで行いたいです. 特にUserAgentとviewportの設定についてご教示いただけますと幸いです. import time,os import chromedriver_binary from selenium import webdriver from selenium.webdriver import Safari from selenium.webdriver.safari.options import Options as SafariOptions from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.select import Select from selenium.webdriver.chrome import service # selenium 4 from selenium.webdriver.chrome.service import Service as ChromeService from selenium.webdriver.chrome.options import Options from webdriver_manager.chrome import ChromeDriverManager #WEBブラウザの起動 chrome_options = Options() #chrome_options.add_argument("--headless") #chrome_options.add_argument("--disable-gpu") #chrome_options.add_argument("--no-sandbox") driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()),options = chrome_options) viewport = { "width": 390, "height": 844, "deviceScaleFactor": 3, "mobile": True } #Chromeの時の設定 ua = "Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1" driver.execute_cdp_cmd("Emulation.setDeviceMetricsOverride", viewport) # ユーザエージェントの変更 driver.execute_cdp_cmd("Emulation.setUserAgentOverride", {"userAgent": ua}) # ページにアクセス driver.get("https://...") #具体的なURLは省略
Topic: Safari & Web SubTopic: General
0
0
324
Jan ’25
how to prevent YouTube app from opening.
Hello I am having issues where when I open a link to YouTube in a wkwebview it opens up the installed YouTube app. I have tried my own way of blocking the opening of the YouTube app but it seems I'm stuck. Is there a way to prevent certain apps from opening automatically from links clicked on or traveled to? Here is what I have so far. guard let url = navigationAction.request.url else { decisionHandler(.cancel) return } //not sure why this code is not being used... // Check if the navigation is a link click with target="_blank" if navigationAction.targetFrame == nil { // Handle the navigation request to open a new window if let url = navigationAction.request.url { // UIApplication.shared.open(url) //opens in safari.... let request = URLRequest(url: url) webView.load(request) decisionHandler(.cancel) return } } // Continue with the navigation if not a link with target="_blank" if url.scheme == "youtube" || url.scheme == "music" { decisionHandler(.cancel) return } //this should cancel app opening for youtube:// links and apple music. // if let url = navigationAction.request.url { // // Allow Google sign-in redirects // if url.absoluteString.contains("accounts.google.com") || url.absoluteString.contains("gstatic.com") { // decisionHandler(.allow) // return // } // } if url.absoluteString.hasPrefix("http") { decisionHandler(.allow) return } if let url = navigationAction.request.url { if shouldDownloadFile(from:url) { // if navigationAction.navigationType == .other, let mimeType = navigationAction.request.allHTTPHeaderFields?["Content-Type"], mimeType.contains("application/pdf") { downloadFile (from: url) decisionHandler(.cancel) return } } decisionHandler(.allow) }
Topic: Safari & Web SubTopic: General
1
0
544
Nov ’24
How to use APIs both loadFileUrl:allowingReadAccessTo: and loadHTMLString:baseURL:?
I need to load both the local source images and remote source images in WKWebView. The url of remote images is a relative url. To load the local images in WebView, I could use loadFileURL(:allowingReadAccessTo:). To load the remote images in WebView, I could use loadHTMLString(:baseURL:). But, I need both the local images and remote images. How can I do?
Topic: Safari & Web SubTopic: General Tags:
0
0
383
Nov ’24
IOS 18.1 wkwebview bug issue
The web page image is not fully displayed, only part of it is rendered. Switch the app to the background and then to the foreground, and the incomplete image will be rendered correctly again.
Topic: Safari & Web SubTopic: General
1
0
451
Dec ’24
FaceTime camera returns promise before solving it
The strange_behaviour.mp4 video attached shows how when running a list of statements to open (startCamera) and close (closeCamera) the camera against a MacBook Pro 2019 using the FaceTime camera, these return their value almost immediately, when in reality the camera is still opening and closing. We believe that there might be a queue for statements to run against the camera and it finishes the awaits when all the statements are inserted in the queue instead of when they are actually solved. We also attached the expected_behaviour.mp4 video where we replicate the same flow but using an external camera instead of the FaceTime camera. In this video, the promises take a bit longer to return but they do once the camera has already been opened and closed the requested amount of times. The project used in the videos is attached as project.tar.xz. We would like to know if the behaviour in strange_behaviour.mp4 is replicable on your side and if there is a way to access the cameras to make it behave like when using an external camera (expected_behaviour.mp4). Attachments: https://drive.google.com/drive/folders/1cOeFb5GMbh4mPOeZiZyyevk3N778Kn1M?usp=sharing
0
0
459
Nov ’24
WebKit crash on iOS 18.3
After the official release of iOS 18.3, our app has collected numerous identical crash logs. These crashes occurred on different devices, but the common denominator is that they all, and only, happened on iOS 18.3. Based on the stack trace, the crash is happening internally within WebKit. The details are as follows: Crashed: com.apple.main-thread 0 WebCore 0x721f9c + 28 1 WebCore 0x15b6924 + 11356 2 WebCore 0x15b174c + 1008 3 WebCore 0x1776e4 + 292 4 WebCore 0x17753c WebCore::SerializedScriptValue::deserialize(OpaqueJSContext const*, OpaqueJSValue const**) + 100 5 WebKit 0x530b28 + 92 6 WebKit 0x5a0d2c + 176 7 WebKit 0x9e74b0 + 956 8 WebKit 0xe43d58 + 392 9 WebKit 0x886ac + 272 10 WebKit 0x88940 + 44 11 WebKit 0x87a74 + 252 12 WebKit 0x875ec + 576 13 JavaScriptCore 0x2f8a48 ***::RunLoop::performWork() + 204 14 JavaScriptCore 0x2f895c ***::RunLoop::performWork(void*) + 36 15 CoreFoundation 0x73f4c CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 16 CoreFoundation 0x73ee0 __CFRunLoopDoSource0 + 176 17 CoreFoundation 0x76b40 __CFRunLoopDoSources0 + 244 18 CoreFoundation 0x75d3c __CFRunLoopRun + 840 19 CoreFoundation 0xc8284 CFRunLoopRunSpecific + 588 20 GraphicsServices 0x14c0 GSEventRunModal + 164 21 UIKitCore 0x3ee674 -[UIApplication _run] + 816 22 UIKitCore 0x14e88 UIApplicationMain + 340 23 18Birdies 0x1b2d3c main + 14 (main.m:14) 24 ??? 0x1ac161de8 (Missing)
Topic: Safari & Web SubTopic: General Tags:
1
0
533
Feb ’25
Type 65 DNS queries
HI, I'm seeking help on the following: When members of public in Singapore are using iOS 14 and above version to surf gov't websites using Safari, noted that Safari is sending Type 65 DNS queries which had also rendered gov't websites slower as compared to similar chromium browsers. Is there any other workarounds that we can advise the public to adopt?
Topic: Safari & Web SubTopic: General
0
0
333
Nov ’24
Issue with iOS Safari Handling Updates in .ics Files
I have an endpoint that generates a .ics file. From my mobile app, I open the browser (Safari) and retrieve the .ics file. In Safari, the events are displayed as expected, and I can use the "Add All" button to add them to the calendar. After clicking "Add All," I can select the desired calendar, and the events are successfully added (see screenshots 1 and 2 below). Here’s the initial .ics file response: BEGIN:VCALENDAR VERSION:2.0 CALSCALE:GREGORIAN PRODID:NAME BEGIN:VEVENT DTSTAMP:20250101T195917Z DTSTART:20250102T131600 DTEND:20250102T142500 SUMMARY:My Event 1 UID:unique-uid1 LAST-MODIFIED:20250101T155715Z DESCRIPTION:Description SEQUENCE:1 END:VEVENT BEGIN:VEVENT DTSTAMP:20250101T195917Z DTSTART:20250103T131600 DTEND:20250103T135600 SUMMARY:My Event 2 UID:unique-uid2 LAST-MODIFIED:20250101T155715Z DESCRIPTION:Description SEQUENCE:1 END:VEVENT END:VCALENDAR Later, I updated the .ics file with new event details: BEGIN:VCALENDAR VERSION:2.0 CALSCALE:GREGORIAN PRODID:NAME BEGIN:VEVENT DTSTAMP:20250102T195917Z DTSTART:20250104T131600 DTEND:20250104T142500 SUMMARY:My Event 1 Update UID:unique-uid1 LAST-MODIFIED:20250104T155715Z DESCRIPTION:Description SEQUENCE:2 END:VEVENT BEGIN:VEVENT DTSTAMP:20250102T195917Z DTSTART:20250105T131600 DTEND:20250105T142500 SUMMARY:My Event 2 Update UID:unique-uid2 LAST-MODIFIED:20250102T155715Z DESCRIPTION:Description SEQUENCE:2 END:VEVENT END:VCALENDAR I updated everything according to the iCalendar documentation: UID remained unchanged SEQUENCE has been updated DTSTAMP has been updated LAST-MODIFIED has been updated However it seems like that Safari can't handle updates on events. In the preview we can see the changes, but when I click on "Add All" button, nothing happens. The same behavior is working with other calendars like Outlook (web view) or Google Calendar. My Questions: Is there a property missing from my .ics file that is necessary for iOS Safari to handle updates? Is Safari not designed to handle event updates in this way? Should I consider moving to a subscription-based solution to manage updates more reliably? Any insights or suggestions would be greatly appreciated!
0
0
598
Jan ’25
iOS18 WKWebView URLProtocol
In our project, URLProtocol is used to intercept the request of WKWebView.loadRequest. On iOS18, if the APP is idle for more than 10 minutes and then clicks on an H5 page, the time from WKWebView.loadRequest -> URLProtocol.canInitWithRequest will be as long as 600ms or more, but the second time the H5 page is opened, it will only be 80ms. This only occurs on iOS18 models.
2
0
699
Nov ’24
How to modify the global window object in Safari Extensions?
I want use the Safari Extension to decorate the window.fetch function, But No matter how I try, I can't get the fetch function to execute correctly. I was going through the documentation: https://developer.apple.com/documentation/safariservices/using-injected-style-sheets-and-scripts and found this sentence: "Injected scripts have an implied namespace — you don’t have to worry about your variable or function names conflicting with those of the website author, nor can a website author call functions in your extension. In other words, injected scripts and scripts that you include in the webpage run in isolated worlds, with no access to each other’s functions or data." Does this mean I can't modify the window object in the content script just like a Chrome extension does with the webpage? BTW, In chrome I use chrome.scripting.executeScript API, and in plasmo I just use world: "MAIN" content script's config to achieved this feature.
1
0
338
Feb ’25
How to interact programatically with the popup paste button
I am trying to figure out a way to programatically paste the contents of the clipboard into a series of text input fields. Specifically, this is for a security code entry screen, where the user will receive a code as a string of number characters. After verifying that the string represents a number, I split it into an array of single number chars, then paste the value at each index into each input. This works fine in Chrome and Firefox, but fails in Safari. After a lot of research, I have found that programatic pasting is a challenge on this platform. I did discover that if I listen for the focusin event and then get the contents of the clipboard, a popup "paste" button will appear. Clicking it does nothing, but I'm thinking that I might be able to grab the button in code and bend it to my will. Can anyone tell me how to interact with that button?
Topic: Safari & Web SubTopic: General
0
0
229
Nov ’24