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

All subtopics

Post

Replies

Boosts

Views

Activity

WKWebView on iOS 18: Video Auto-Play Not Working Inline, Launching in Full-Screen Instead
Hello, I'm experiencing an issue with WKWebView in my iOS app when running on devices with iOS 18. Specifically, when auto-playing videos, they do not play inline as expected but instead switch to full-screen mode. This problem only occurs on iOS 18; in earlier versions, the videos played inline without any issues. Here is the configuration I'm using for WKWebView: let configuration: WKWebViewConfiguration = WKWebViewConfiguration.init() configuration.allowsInlineMediaPlayback = true configuration.mediaTypesRequiringUserActionForPlayback = [] Additionally, I have set the 'playsinline' attribute in the video tag on the web page. Despite these settings, when the webpage initially loads, the video sometimes plays in full-screen mode rather than inline. I am looking for a solution to ensure that videos always play inline as intended on iOS 18. Has anyone encountered a similar issue or know of any workarounds? Any help would be greatly appreciated! Thank you!
0
0
417
Sep ’24
Xcode 16 JSGlobalContextCreate memory leak
The following has a memory leak on Xcode 16. JSGlobalContextRef _cx = JSGlobalContextCreateInGroup(NULL, NULL); #ifndef NDEBUG #ifdef __IPHONE_16_4 if (__builtin_available(iOS 16.4, *)) { JSGlobalContextSetInspectable(_cx, true); } #endif #endif JSStringRef ctxName = JSStringCreateWithUTF8CString("Xcode16"); JSGlobalContextSetName(_cx, ctxName); JSStringRelease(ctxName); JSGlobalContextRelease(_cx);
2
0
270
Sep ’24
run Http in webview local
hi, i have this problem. i need to use a webview to charge a file locally, to be more specific a file SCORM, like a mini web project. so i was making tests and the way to see all te content is in a http server. i mean if i click in the index.html of the file in my computer the page doesn't charge all the content, so i opened visual studio code and running Live Server thats provide me a project in http, well with that the project works. in android i'm make the example with something called WebViewAssetLoader, with that i can setup asset loader to handle local asset paths and override a WebView client, and if request is to local file, intercept and serve local. i want to know if in swift i have a way to intecept it a serve local this is one of the a lot of ways that i was tried and this is the example that works for me in android
2
0
266
Sep ’24
Safari extension - badgeText and title set for a tab
I am building Safari extension. In my background script I am setting badge text and title like this: browser.action.setBadgeText({text: badgeText, tabId: tabId}); browser.action.setTitle({title: badgeText + " found images", tabId: tabId}) , where tabId is correct id of current tab. I was expecting that in this way I am setting a different badge and title for different tabs, so that badge and title would automatically switch if I activate different tab. However this does not happen, badge and title behave as if set globaly and don't change with tabs. How is this expected to work? I have also tried to set badge globally, and update it every time user switches a tab. I have set up listener like this: browser.tabs.onActivated.addListener(function(actInfo) { console.log("switched tab to " + actInfo.tabId); }); , however the event never fires, tab switch is never logged in console. Am I doing something wrong here? This is my manifest, if there was a problem with permissions or something similar. { "manifest_version": 3, "default_locale": "en", "name": "Test", "description": "Test Extension", "version": "1.0", "icons": { "48": "images/icon-48.png", "96": "images/icon-96.png", "128": "images/icon-128.png", "256": "images/icon-256.png", "512": "images/icon-512.png" }, "action": { "default_title": "a test title", "default_popup": "popup/hello.html", "default_icon": { "16": "images/toolbar-icon-16.png", "19": "images/toolbar-icon-19.png", "32": "images/toolbar-icon-32.png", "38": "images/toolbar-icon-38.png", "48": "images/toolbar-icon-48.png", "72": "images/toolbar-icon-72.png" } }, "web_accessible_resources": [ { "matches": ["*://*/*"], "resources": ["images/*", "css/*", "scripts/lib/*"] } ], "background": { "service_worker": "scripts/background.js", "type": "module" }, "content_scripts": [ { "js": [ "scripts/content.js" ], "matches": [ "http://*/*", "https://*/*" ], "css": ["css/style.css"], "run_at": "document_end" } ], "permissions": [ "nativeMessaging", "tabs" ] }
3
0
292
Sep ’24
App not releasing memory immediately
We as a team of engineers work on an app intended to visualize medical images. The type of situations where the app is used involves time critical decision making for acute clinical conditions. Stability of the app and performance are of almost importance and can directly help timely treatment action. The app we are developing uses Javascript. It has been observed the footprint of the app is lagging by 2 to 3 seconds in releasing memory while javascript is expecting the memory to be cleared. This is affecting the stability of our application and preventing us in delivering the right quality of application. The problem specifically can be described as follows, using javascript create an array and then remove it and after removal of the array, create a new array of the same size immediately and again remove it. Because the memory is not released in time, if you repeat these steps a few times the app memory footprint will increase and that crashes the app. To reproduce this scenario, we have created a simple app which creates an array with size of 100MB and checks the memory footprint using the Xcode instrument tool. When we create an array of 100MB size, sometimes it shows the memory footprint peak of around 700MB-800MB and when we clear the array by assigning it with an empty array it releases the memory after 2-3 seconds. Considering the critical nature of the app, I urge you to look into this and provide necessary support and resolution. Please refer below sample code that will help to reproduce the mentioned scenario. import UIKit import WebKit class ViewController: UIViewController, WKUIDelegate { @IBOutlet var webView: WKWebView! let myHTML = """ <!DOCTYPE html> <html> <head> <style> .button-style { width: 400px; height: 200px; margin: 15px; font-size: 50px; } </style> </head> <body> <button type="button" class="button-style" onclick="loadDataInCache()">Load Data In Cache</button> <button type="button" class="button-style" onclick="removeDataFromCache()">Clear Cache</button> <script> const size = 1024 * 1024 * 100; let numberArray = []; function loadDataInCache() { numberArray = Array(size).fill(0); } function removeDataFromCache() { numberArray = []; } </script> </body> </html> """ override func viewDidLoad() { super.viewDidLoad() // self.view.addSubview(webView) webView.loadHTMLString(myHTML, baseURL: nil) } override func loadView() { let webConfiguration = WKWebViewConfiguration() webView = WKWebView(frame: .zero, configuration: webConfiguration) webView.uiDelegate = self view = webView } }
2
2
388
Sep ’24
Enable/disable Safari web extension content blocker using declarative_net_request in manifest
Is it possible to enable/disable the enabled flag before the extension is loaded? we want to have a button in our app which controls the availability of the content blocker ruleSet in declarative_net_request in manifest (version 2). "declarative_net_request": { "rule_resources": [ { "id": "ruleset_1", "enabled": true, "path": "ruleset_1.json" } ] },
3
0
363
Sep ’24
Options and Services in Safari with Selenium?
Firefox and Chrome provide various options and services to set up browser characteristics while testing. These can be used with Selenium while setting up the driver. An example with Firefox is setting a custom user agent and a download directory different than the default. Using Python: from selenium.webdriver.firefox.options import \ Options as FirefoxOptions from selenium.webdriver.firefox.service import \ Service as FirefoxService firefox_options = FirefoxOptions() # set up user agent user_agent = UserAgent().get_user_agent() firefox_options.set_preference("general.useragent.override", user_agent) # set alternate download location firefox_options.set_preference('browser.download.folderList', 2) firefox_options.set_preference('browser.download.dir', download_dir_path) Many of these browser-specific options and services are listed at Selenium's website under Supported Browsers. However, Safari's information is very limited. On Selenium's site, for example, they list how to turn on Safari's limited logging: service = webdriver.SafariService(service_args=["--diagnose"]). Then, they point us to About WebDriver for Safari - which shows automaticInspection and automaticProfiling. The page primarily describes security features for testing with Safari. In a regular user session, one can configure an alternate download directory, set a custom profile with specific settings for that profile, and so on. And, in the Developer Menu I can set some of these items manually for a given session (user agent, for example). How can I access these features within Safari for use in automated web testing with Selenium? Edit: Alternatively, does Apple have, or recommend, a different automated testing package for Safari?
1
0
292
Sep ’24
iOS 18 - Safari Extension turned on but not working & storage nuked
Hello, I am developer of a Safari Extension. I have had a few reports from users who have paid for my app and have upgraded to iOS 18 report that the extension isn't working any more. I upgraded myself and opened Safari, my extension was turned on but not working. I turned the extension off and back on, then it started working. However it did not have anything in browser.storage.local... so it has to be setup again from scratch for all of these users... This has been confirmed by multiple users. What the hell is this Apple? Why have you nuked Safari Extension storage when upgrading to iOS 18? And why does the extension stop working when upgrading to iOS 18? Nowhere near good enough... was this even tested?
2
1
647
Sep ’24
The difficulties of web development in the face of opaque inappropriate Safari autofill behavior
Through focussed debugging, I have discerned that if a web page's "text" input element's name attribute contains a dash (and does not contain -#- (e.g. -0-)), Safari will: Display a contacts icon inside the field and Add a drop-down populated with phone numbers from the user's contact card (on top of any pre-existing datalist dropdown). Ignore the element's autocomplete="off" There is post after post and blog article after blog article on the web that propose endless solutions to similar Safari issues, each working in various different contexts. It's a mess really. I am currently trying to develop a django web form for scientific data using django's FormSet class. Specifically, I was using FormsSet.empty_form to create a javascript clone-able form that would propagate field values to added (numbered) forms. I implemented things incrementally. I started out with a regular form and encountered a behavior where an autofill dropdown would present me with previously submitted values, e.g.: Adding autocomplete="off" to the input element prevented this. I then implemented formsets, defaulting to 1 form (so that all input elements' names started with form-0-) and everything worked as expected. However, when I changed the strategy with default to 0 initial forms and presented FormSet.empty_form as a template that would be cloned anytime files were dropped/selected, I started getting phone number drop-downs in all of the test fields: I googled this quite a bit and tried many things, including a strategy I'd employed before, to no avail, so to make debugging this issue easier and try a bunch of things quickly, I saved the page source and put it in the static folder, then started tweaking things to figure out what was causing this to happen. It appears that anytime a text input element's name attribute contains a dash (and does not contain -#-), Safari assumes it's a phone number field, despite the fact that the name's text, placeholder's text, possibly the label's text, the fact that the element has a list attribute set to the ID of a datalist element, and the fact that autocomplete is explicitly set to off. I would say that the heuristic used to trigger phone number autofill needs some serious tweaking. Not only that, but web developers need more transparency on how it works, so that non-sensical autofill behavior like this can be avoided. Another aspect of this is that if you have lots of cloned forms that Safari tries to apply autofill to, it dramatically decreases the page's performance. Safari autofill behavior has been a constant bane of mine, because many of our users use macs. I have not yet tried CSS solutions I've seen hints of (mainly because all the articles/posts I've seen about them are quite dated). Any information anyone can provide to tame Safari autofill and prevent this errant behavior would be much appreciated.
0
0
207
Sep ’24
Universal Linking not working
Hi Team, Universal linking is not working with safelink and when using the amazon SES. https://docs.aws.amazon.com/ses/ When we have email template and click on the links we are unable to open the app with safe links, does anyone faced this problem before for when using safe link with amazon SES or any other services. Please help me to resolve this issue as soon as possible.
1
1
266
Sep ’24
Content blocker extensions vs content blocking using Safari extensions for dynamic URLs
We have observed that blocking content using Safari web extension does not fetch few URLS within the #document (documentURLs) because the onBeforeRequest webextension API is currently not available in Safari iOS. But it works fine using the Content blocking extension. We have a list of URLs which we want to block from the website. Which extension would you suggest the Content blocking extension or the Safari web extension?
1
0
276
Sep ’24
Cannot Play mp3 File via AudioContext in iOS 18 Safari
I have a Safari extension that plays audio via the javascript AudioContext API. It was working fine under iOS 17 and is now broken under iOS 18. It does not play audio at all. I've tried in both the iOS 18 public beta and the iOS 18.1 developer beta. It is broken in both of them. I've also created Feedback item FB15170620 which has a url attached to a page I created which demonstrates the issue.
0
0
362
Sep ’24
WKWebview form filling with cross origin iframe
Hi everyone, I’m working on an iOS app using WKWebView, and I have a specific use case involving cross-origin iframes and form autofill. I’m wondering if it’s possible to programmatically fill input elements, such as credit card numbers, within a cross-origin iframe loaded in a WKWebView. I understand that due to the Same-Origin Policy, direct DOM manipulation of cross-origin iframes is restricted. However, I’m curious if there are any methods or workarounds that might allow me to achieve this, specifically within the context of WKWebView. Thanks.
2
0
407
Sep ’24
SFSafariApplication::dispatchMessage() in xcode 16
We are making Safari extension for MacOS, that uses SFSafariApplication.dispatchMessage() to communicate between native and javascript parts of extension. Until recently everything worked, however after update to xcode 16 I started getting this error: 'dispatchMessage(withName:toExtensionWithIdentifier:userInfo:completionHandler:)' is unavailable in application extensions for macOS: Not available to extensions 'dispatchMessage(withName:toExtensionWithIdentifier:userInfo:completionHandler:)' has been explicitly marked unavailable here (SafariServices.SFSafariApplication) I looked into documentation, however I did not find any hint of dispatchMessage() being replaced by something else. According to https://developer.apple.com/documentation/safariservices/messaging-between-the-app-and-javascript-in-a-safari-web-extension this is the way communication should be done. Is it a bug? Or can someone direct me to working alternative of communication?
6
0
446
Sep ’24
Shadows are not displayed correctly
Open PDF https://bug-279812-attachments.webkit.org/attachment.cgi?id=472582 in Safari using https://mozilla.github.io/pdf.js/web/viewer.html It looks like: In Chrome it looks like: Bug tracker: https://bugs.webkit.org/show_bug.cgi?id=279812 Please fix the issue.
0
0
184
Sep ’24
Plans for web-based mID verification?
Hi, I run an online enrollment system for a school in Arizona. Through this, we've been able to streamline document collection ten-fold, however, we're now trying to optimize where the documents come from. Since Arizona supports mID, I was curious if Apple has any plans on allowing websites access to mID verification? I noticed Google had an interest form for a web API, so if there is one for Apple, I'd appreciate the link (i can't find it)! Thanks!
0
0
170
Sep ’24