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
137 Views
The following is the stack trace. Call graph: 2246 Thread_14270191 DispatchQueue_1: com.apple.main-thread (serial) + 2246 start (in dyld) + 462 [0x1125c851e] + 2246 WebKit::XPCServiceMain(int, char const**) (in WebKit) + 85 [0x7ff911bbb759] + 2246 xpc_main (in libxpc.dylib) + 99 [0x7ff80d4af239] + 2246 _xpc_objc_main (in libxpc.dylib) + 773 [0x7ff80d4af816] + 2246 -[NSRunLoop(NSRunLoop) run] (in Foundation) + 76 [0x7ff80e70e8d7] + 2246 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] (in Foundation) + 216 [0x7ff80e683d9a] + 2246 CFRunLoopRunSpecific (in CoreFoundation) + 562 [0x7ff80d82f7ac] + 2237 __CFRunLoopRun (in CoreFoundation) + 1276 [0x7ff80d830368] + ! 2237 __CFRunLoopServiceMachPort (in CoreFoundation) + 319 [0x7ff80d831cdd] + ! 2237 mach_msg (in libsystem_kernel.dylib) + 56 [0x7ff80d72ece8] + ! 2237 mach_msg_trap (in libsystem_kernel.dylib) + 10 [0x7ff80d72e97a] + 8 __CFRunLoopRun (in CoreFoundation) + 2010 [0x7ff80d830646] + ! 3 __CFRunLoopDoTimers (in CoreFoundation) + 307 [0x7ff80d849ef8] + ! : 2 __CFRunLoopDoTimer (in CoreFoundation) + 923 [0x7ff80d84a388] + ! : | 2 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ (in CoreFoundation) + 20 [0x7ff80d84a899] + ! : | 1 WebCore::timerFired(__CFRunLoopTimer*, void*) (in WebCore) + 18 [0x7ff90edb9a62] + ! : | + 1 ***::AutodrainedPool::AutodrainedPool() (in JavaScriptCore) + 0 [0x7ff825ef0050] + ! : | 1 WebCore::timerFired(__CFRunLoopTimer*, void*) (in WebCore) + 31 [0x7ff90edb9a6f] + ! : | 1 ***::Detail::CallableWrapper<WebCore::ThreadTimers::setSharedTimer(WebCore::SharedTimer*)::$_0, void>::call() (in WebCore) + 148 [0x7ff91092a534] + ! : 1 __CFRunLoopDoTimer (in CoreFoundation) + 104 [0x7ff80d84a055] + ! : 1 CFRetain (in CoreFoundation) + 65 [0x7ff80d7b598e] + ! 2 __CFRunLoopDoTimers (in CoreFoundation) + 191 [0x7ff80d849e84] + ! : 1 __NSArrayM_new (in CoreFoundation) + 50 [0x7ff80d7cf1cc] + ! : | 1 __CFAllocateObject (in CoreFoundation) + 15 [0x7ff80d7b58ef] + ! : | 1 class_createInstance (in libobjc.A.dylib) + 64 [0x7ff80d5fe1da] + ! : | 1 _malloc_zone_calloc (in libsystem_malloc.dylib) + 60 [0x7ff80d59eb75] + ! : | 1 szone_malloc_should_clear (in libsystem_malloc.dylib) + 66 [0x7ff80d5837d2] + ! : | 1 tiny_malloc_should_clear (in libsystem_malloc.dylib) + 32 [0x7ff80d584765] + ! : 1 objc_msgSend (in libobjc.A.dylib) + 26 [0x7ff80d5fe41a] + ! 2 __CFRunLoopDoTimers (in CoreFoundation) + 205 [0x7ff80d849e92] + ! : 1 -[__NSArrayM insertObject:atIndex:] (in CoreFoundation) + 399 [0x7ff80d7d27ee] + ! : | 1 _platform_bzero$VARIANT$Haswell (in libsystem_platform.dylib) + 0 [0x7ff80d77e600] + ! : 1 -[__NSArrayM insertObject:atIndex:] (in CoreFoundation) + 257 [0x7ff80d7d2760] + ! 1 __CFRunLoopDoTimers (in CoreFoundation) + 222 [0x7ff80d849ea3] + 1 __CFRunLoopRun (in CoreFoundation) + 1280 [0x7ff80d83036c] 2246 Thread_14270227: WebCore: Scrolling + 2246 thread_start (in libsystem_pthread.dylib) + 15 [0x7ff80d766f6b] + 2246 _pthread_start (in libsystem_pthread.dylib) + 125 [0x7ff80d76b4e1] + 2246 ***::wtfThreadEntryPoint(void*) (in JavaScriptCore) + 9 [0x7ff825ef0039] + 2246 ***::Thread::entryPoint(***::Thread::NewThreadContext*) (in JavaScriptCore) + 246 [0x7ff82711ffa6] + 2246 ***::RunLoop::run() (in JavaScriptCore) + 19 [0x7ff827109c53] + 2246 CFRunLoopRun (in CoreFoundation) + 40 [0x7ff80d8b782b] + 2246 CFRunLoopRunSpecific (in CoreFoundation) + 562 [0x7ff80d82f7ac] + 2246 __CFRunLoopRun (in CoreFoundation) + 1276 [0x7ff80d830368] + 2246 __CFRunLoopServiceMachPort (in CoreFoundation) + 319 [0x7ff80d831cdd] + 2246 mach_msg (in libsystem_kernel.dylib) + 56 [0x7ff80d72ece8] + 2246 mach_msg_trap (in libsystem_kernel.dylib) + 10 [0x7ff80d72e97a] 1 Thread_14270224 DispatchQueue_13: com.apple.root.default-qos (concurrent) 1 start_wqthread (in libsystem_pthread.dylib) + 15 [0x7ff80d766f57] 1 _pthread_wqthread (in libsystem_pthread.dylib) + 326 [0x7ff80d767fd0] 1 _dispatch_workloop_worker_thread (in libdispatch.dylib) + 753 [0x7ff80d5c0eee] 1 _dispatch_mach_invoke (in libdispatch.dylib) + 484 [0x7ff80d5c9b77] 1 _dispatch_lane_serial_drain (in libdispatch.dylib) + 342 [0x7ff80d5b61cd] 1 _dispatch_mach_msg_invoke (in libdispatch.dylib) + 445 [0x7ff80d5c9041] 1 _dispatch_client_callout4 (in libdispatch.dylib) + 9 [0x7ff80d5b03b1] 1 _xpc_connection_mach_event (in libxpc.dylib) + 1382 [0x7ff80d4a5947] 1 _xpc_connection_call_event_handler (in libxpc.dylib) + 56 [0x7ff80d4a6b6c] 1 WebKit::LaunchServicesDatabaseManager::handleEvent(NSObject<OS_xpc_object>*) (in WebKit) + 176 [0x7ff911a6b0de] 1 -[LSDatabaseContext(WebKitChangeTracking) observeDatabaseChange4WebKit:] (in LaunchServices) + 519 [0x7ff80dd8e80a] 1 _LSDatabaseCreate (in LaunchServices) + 68 [0x7ff80dcc7a7c] 1 _LSDatabaseCreateWithAccessQueue (in LaunchServices) + 769 [0x7ff80dd81865] 1 _CSGetStringForCharacters (in CoreServicesStore) + 56 [0x7ff8100cc7af] 1 CSStore2::String::Find(CSStore2::Store&, char const*, unsigned int) (in CoreServicesStore) + 554 [0x7ff8100cca02] 1 invocation function for block in CSStore2::String::Find(CSStore2::Store&, char const*, unsigned int) (in CoreServicesStore) + 27 [0x7ff8100ccbfe] Looks like the last thread is stuck in a database read call. Can anyone please help in a workaround for this?
Posted Last updated
.
Post not yet marked as solved
1 Replies
256 Views
I am looking for some guidance on an authentication issue related to AirPlay sessions for HLS streams. Our app currently uses token authentication for our HLS streams, but for AirPlay sessions we only authenticate on the master manifest since the user has already authenticated via the app and However, this does leave open the potential for someone to fake an AirPlay User-Agent and request rendition manifests and segments without authentication. We wouldn't be able to perform the token authentication on the AirPlay since we can't pass the custom header with the token across the AirPlay session boundaries. Support showed me a potential workaround of using " AVAssetResourceLoader", but that would not work in my case, as I don't have the ability to make changes on the iOS app. So that leads me to trying to solve this issue at the CDN level. What I would like to do is try and verify that requests are coming from valid AirPlay devices/sessions by checking for headers that are included specifically for an AirPlay session. Searching online led me to these two possible headers, " X-Apple-Device-ID: X-Apple-Session-ID: " ,but I have not been able to see them when checking on the CDN. Is there any documentation on default/standard headers that would/should appear in AirPlay requests? Thanks
Posted Last updated
.
Post not yet marked as solved
9 Replies
18k Views
Hi!I currently developing a mobile website and found that Safari on iOS has some problems setting the focus on inputs when they are inside an iframe.When in a page you have many inputs you can tap on a field and then use the next / previous buttons on the keyboard to navigate between the fields. When the focus move to another input Safari scroll automatically the page centering the field in the page. This is great and works well.The problem is when the fields are inside a page of an iframe. In this case when you change focus from one field to another Safari has some kind of issue; the page “bounce” and the focused field is not centered in the page.I have made a video of a simple page that has this issue. In the first part of the video the page without the iframe is loaded and the focus works correctly. In the second part the page with the iframe is loaded and the issue is visible.http://www.dale1.ch/documents/safari_iframe_focus_issue.movThe code of the first page (testinput.html) where the focus is correctly handled is this:&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Test input&lt;/title&gt; &lt;meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" /&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt;&lt;span&gt;Input 1: &lt;/span&gt;&lt;input type="text" tabindex="1" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 2: &lt;/span&gt;&lt;input type="text" tabindex="2" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 3: &lt;/span&gt;&lt;input type="text" tabindex="3" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 4: &lt;/span&gt;&lt;input type="text" tabindex="4" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 5: &lt;/span&gt;&lt;input type="text" tabindex="5" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 6: &lt;/span&gt;&lt;input type="text" tabindex="6" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 7: &lt;/span&gt;&lt;input type="text" tabindex="7" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 8: &lt;/span&gt;&lt;input type="text" tabindex="8" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 9: &lt;/span&gt;&lt;input type="text" tabindex="9" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 10: &lt;/span&gt;&lt;input type="text" tabindex="10" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 11: &lt;/span&gt;&lt;input type="text" tabindex="11" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 12: &lt;/span&gt;&lt;input type="text" tabindex="12" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 13: &lt;/span&gt;&lt;input type="text" tabindex="13" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 14: &lt;/span&gt;&lt;input type="text" tabindex="14" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 15: &lt;/span&gt;&lt;input type="text" tabindex="15" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 16: &lt;/span&gt;&lt;input type="text" tabindex="16" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 17: &lt;/span&gt;&lt;input type="text" tabindex="17" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 18: &lt;/span&gt;&lt;input type="text" tabindex="18" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 19: &lt;/span&gt;&lt;input type="text" tabindex="19" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 20: &lt;/span&gt;&lt;input type="text" tabindex="20" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 21: &lt;/span&gt;&lt;input type="text" tabindex="21" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 22: &lt;/span&gt;&lt;input type="text" tabindex="22" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 23: &lt;/span&gt;&lt;input type="text" tabindex="23" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 24: &lt;/span&gt;&lt;input type="text" tabindex="24" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 25: &lt;/span&gt;&lt;input type="text" tabindex="25" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 26: &lt;/span&gt;&lt;input type="text" tabindex="26" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 27: &lt;/span&gt;&lt;input type="text" tabindex="27" /&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;Input 28: &lt;/span&gt;&lt;input type="text" tabindex="28" /&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt;This is the code of the page that has the issue (testinput_iframe.html):&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Test input&lt;/title&gt; &lt;meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" /&gt; &lt;/head&gt; &lt;body&gt; &lt;iframe src="/testinput.html" /&gt; &lt;/body&gt; &lt;/html&gt;The issue is present in Safari on the iPhone, iPad and the xCode Simulator from version 8.4 to version 9.2.Someone know if this is a bug? There is way to fix it in css or javascript?Thanks and sorry for my english! 😉
Posted
by DaleOne.
Last updated
.
Post not yet marked as solved
0 Replies
244 Views
(TL;DR at bottom) Hi everyone, Going into this I'd like to say first that I am by no means a web developer and I know nothing about how browsers are built. I've got a really specific use case that requires me to disable hardware acceleration on my browser. When away from each other, my partner and I like to watch shows and movies together over Zoom's Screen Sharing. For a while I've just been using Chrome to handle that and Safari for everything else. The reason I use Chrome for this is that when I turn off hardware acceleration on Chrome it lets me share my screen on websites like Netflix, Hulu, etc. without an empty screen appearing. But I just don't want Chrome on my computer anymore, if I can somehow get hardware acceleration off on Safari. It's nice to just use one browser for everything, especially since Safari is great for my battery. I looked into this online and something I read says that you just aren't able to do this anymore in Safari but then I asked my friend who does dabble in this sort of stuff and he says there's probably something under: Develop --&gt; Experimental Features that I can mess around with to turn it off. If anybody has pointers for me, I'd really appreciate it! Thanks :-) TL;DR - I'm looking for a way to turn off hardware acceleration on Safari like you are able to do in Chrome
Posted
by kian-nick.
Last updated
.
Post not yet marked as solved
8 Replies
3.5k Views
An error is reported when playing h5 audio or video elements in wkwebview: Error acquiring assertion: Error Domain=RBSAssertionErrorDomain Code=3 "Required client entitlement is missing" UserInfo={RBSAssertionAttribute=RBSDomainAttribute| domain:"com.apple.webkit" name:"MediaPlayback" sourceEnvironment:"(null)", NSLocalizedFailureReason=Required client entitlement is missing} Then the performance of the webview will become very poor. There is an audio element and a button button in my HTML file. Click the button to play audio. body button onclick="handleClick()"PLAY/button audio id="audio" src="https://ac-dev.oss-cn-hangzhou.aliyuncs.com/test-2022-music.mp3"/audio script function handleClick() { document.getElementById("audio").play(); } /script /body Create a wkwebview to load the html file in my demo APP. class ViewController: UIViewController , WKUIDelegate{ var webView: WKWebView! override func loadView() { let config = WKWebViewConfiguration() config.preferences.javaScriptEnabled = true config.allowsInlineMediaPlayback = true webView = WKWebView(frame: .zero, configuration: config) //.zero webView.uiDelegate = self view = webView } override func viewDidLoad() { super.viewDidLoad() let myURL = URL(string: "https://ac-dev.oss-cn-hangzhou.aliyuncs.com/test-2022-py.html") let myRequest = URLRequest(url: myURL!) webView.load(myRequest) } } Click the button in the HTML to play the audio, and you can see the error report on the xcode. iPadN[2133:855729] [assertion] Error acquiring assertion: Error Domain=RBSAssertionErrorDomain Code=3 "Required client entitlement is missing" UserInfo={RBSAssertionAttribute=RBSDomainAttribute| domain:"com.apple.webkit" name:"MediaPlayback" sourceEnvironment:"(null)", NSLocalizedFailureReason=Required client entitlement is missing} To sum up, this error will appear when playing audio or video in HTML. Then the app performance will drop a lot, and the interactive response will be very slow.
Posted
by pengyong.
Last updated
.
Post not yet marked as solved
1 Replies
339 Views
Hi.I've got an iPad Air 2 and recent iOS 9.2.There is an issue with it. I'm currently working on WebGL web application. If you launch WebGL web application, using frame buffers (for example this demo from Chrome Experiments: http://labs.fluuu.id/tubes/), make Safari application go to background (click the home button, then double-click the home button, press the Safari icon in the multitasking bar), it appears that Safari will clear the frame buffers.My question: Is there a way to restore framebuffers?Thanks
Posted
by blend4web.
Last updated
.
Post marked as solved
2 Replies
193 Views
I am trying to load a WKWebView in my MacOS Authorization Plugin view. All I get is a blank white screen. But when I initiate the login (i.e, pass on the login mechanism to the next system login mechanisms), the webview starts to load. I added WKNavigationDelegate methods to see when they are getting called. All delegate methods (didCommit, didFinish etc..) are getting called after the current login mechanism had passed. I want to load the WKWebView in my custom login mechanism. What should I do?
Posted
by mac_rudd.
Last updated
.
Post not yet marked as solved
1 Replies
303 Views
Summary Safari "WebKit Build Archives" (AKA Safari nighties) crashes when opening Preferences. The Preference window doesn't even pop up before crashing. Steps to reproduce Download a nightly build of Safari https://webkit.org/build-archives/#mac-monterey-x86_64 Open run-webkit-archive Go got Safari > Preferences Observer crash Environment Does crash on: MacBook Pro (15-inch, 2017) macOS 12.2.1 and 12.3.1 WebKit Build Archives (249860@main, 249854@main, 249817@main, 292562) Spot checked a few others from Feb to April as well Do NOT crash on: Safari included with macOS 12.3.1 (Version 15.4 (17613.1.17.1.13)) Safari Technology Preview 143 (Safari 15.4, WebKit 17614.1.7.7) 142 141 Crash stack trace 2022-04-21 13:44:00.485 SafariForWebKitDevelopment[13786:133729] *** Assertion failure in -[NSMenuItem initWithTitle:action:keyEquivalent:], NSMenuItem.m:477 2022-04-21 13:44:00.487 SafariForWebKitDevelopment[13786:133729] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: aString != nil' *** First throw call stack: ( 0 CoreFoundation 0x00007ff8112d81e3 __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007ff811038c13 objc_exception_throw + 48 2 Foundation 0x00007ff81217ac23 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 267 3 AppKit 0x00007ff813c74759 -[NSMenuItem initWithTitle:action:keyEquivalent:] + 363 4 Safari 0x00007ff91e63417a +[NSMenuItem(BrowserExtras) safari_menuItemForFileAtPath:] + 140 5 Safari 0x00007ff91e505a0b -[GeneralPreferences _updateDownloadLocationMenu] + 158 6 libdispatch.dylib 0x00007ff810fda0cc _dispatch_call_block_and_release + 12 7 libdispatch.dylib 0x00007ff810fdb317 _dispatch_client_callout + 8 8 libdispatch.dylib 0x00007ff810fe7c78 _dispatch_main_queue_drain + 943 9 libdispatch.dylib 0x00007ff810fe78bb _dispatch_main_queue_callback_4CF + 31 10 CoreFoundation 0x00007ff81129a9c7 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 11 CoreFoundation 0x00007ff81125b93f __CFRunLoopRun + 2771 12 CoreFoundation 0x00007ff81125a7ac CFRunLoopRunSpecific + 562 13 HIToolbox 0x00007ff819ee1ce6 RunCurrentEventLoopInMode + 292 14 HIToolbox 0x00007ff819ee1a4a ReceiveNextEventCommon + 594 15 HIToolbox 0x00007ff819ee17e5 _BlockUntilNextEventMatchingListInModeWithFilter + 70 16 AppKit 0x00007ff813c8153d _DPSNextEvent + 927 17 AppKit 0x00007ff813c7fbfa -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1394 18 Safari 0x00007ff91e16d8b5 -[BrowserApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 224 19 AppKit 0x00007ff813c722a9 -[NSApplication run] + 586 20 AppKit 0x00007ff813c46227 NSApplicationMain + 817 21 Safari 0x00007ff91e1581c0 SafariMain + 464 22 dyld 0x000000011583e51e start + 462 ) libc++abi: terminating with uncaught exception of type NSException MessageReceiveQueueMap::addImpl - adding duplicate any id receiver 35
Posted Last updated
.
Post marked as solved
8 Replies
14k Views
I am a web developer.I would like to show off San Francisco fonts to the world.Apple San Francisco fonts [https://developer.apple.com/fonts], includes five font families, found here:Download SF Pro Text, Download SF Compact, Download SF Mono, Download New York, Download SF SymbolsI am developing a website to reduces loss of life and property.Storm-Link.netI am NOT a lawyer, and I need a YES or NO answer.Can I use the San Francisco Fonts as web fonts?EXAMPLEFor those who do not understand Web Development, this means converting each SF Font to a web font format.The standard web font formats are WOFF and WOFF2, beside either TTF or OTF.So the web fonts for SF-Mono_regular.otf are:SF-Mono_regular.otf, SF-Mono_regular.woff and SF-Mono_regular.woff2Coded like this in CSS..code { font-family: 'SF Mono', monospace; }.Deployed online ashttps://MySite/SF-Mono_regular.otf and https://MySite/SF-Mono_regular.woff and https://MySite/SF-Mono_regular.woff2.
Posted
by riverleaf.
Last updated
.
Post not yet marked as solved
0 Replies
147 Views
When I learned to use webview in my app, just added a webview and detected a memory leak, import SwiftUI import WebKit struct SWKWebView: UIViewRepresentable { @Binding var url: String? func makeUIView(context: Context) -> WKWebView { let webview = WKWebView() webview.navigationDelegate = context.coordinator return webview } func updateUIView(_ uiView: WKWebView, context: Context) { if let url = url, let requetURL = URL(string: url) { uiView.load(URLRequest(url: requetURL)) } } func makeCoordinator() -> Coordinator { Coordinator() } class Coordinator: NSObject,WKNavigationDelegate { func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { webView.evaluateJavaScript("document.title") { (result, error) in print("didFinish:\(String(describing: result ?? ""))") } } } } struct TTTest: View { @State var url: String? = "https://www.google.com" var body: some View { SWKW ![]("https://developer.apple.com/forums/content/attachment/d4b6a729-f217-4b1a-9ec4-1372643e14b4" "title=WeChatc57286e9fa2eb9bc5d59b7410d876c33.png;width=1788;height=660") ebView(url: $url) } }
Posted
by acsa.
Last updated
.
Post not yet marked as solved
0 Replies
186 Views
Dear all, I'm using WKWebView to connect a URL2. The webview will load a request which contains http header. But I can't have it works. There is a message below came from Output window. [Process] 0x1260c0218 - [pageProxyID=13, webPageID=14, PID=15418] WebPageProxy::didFailProvisionalLoadForFrame: frameID=3, domain=WebKitErrorDomain, code=102, isMainFrame=1 I've searched some relevant solutions to solve it. I've added the privilege in Info.plist, like Allow Arbitrary Loads, Allow Arbitrary Loads in Web Content. Also I've added my URL in exception domain. But all of these solutions are still not able to work. Do I miss any solution? Please help me out. Thank you in advance. BTW, it works if the WKWebView connect to URL1. But the URL2 doesn't. The prefix is https, so it shouldn't have http problem.
Posted Last updated
.
Post not yet marked as solved
5 Replies
342 Views
Our TPP excludes our own processes from oversight, which makes some things very easy. Only I just found out that when our app uses a WKWebView... it's very securely shuffled off into its own process. With its own signing identifier. And a ppid of launchd. How could I tell that a com.apple.WebKit.Networking process is related to our process? (I note that the Endpoint Security Framework has added a "responsible" audit token, presumably for this sort of situation.)
Posted
by kithrup.
Last updated
.
Post not yet marked as solved
1 Replies
3.2k Views
I have a table view where each cell contains a WKWebView of HTML content. Initially the content has its size to fit a prescribed width and height.What I want to do is allow users to zoom in and out of the WKWebView and while adjusting the height of the cell view.To give some context what I did was attach a Javascript (WKUserScript) to the WKWebView and in the script it containswindow.onload = function () { window.webkit.messageHandlers.sizeNotification.postMessage({width: document.body.scrollWidth, height: document.body.scrollHeight}); }What this does is when the HTML content is loaded, it will send the message with name "sizeNotification" to a UIViewController conforming to the WKScriptMessageHandler. The message contains the scrollHeight which is what I use to set the frame of the WKWebView by adjusting a height constraint.I also save that scrollHeight value which will be important later.After the user zooms in the WKWebView the delegate method scrollViewDidEndZooming gets called which contains the current scaled information of the WKWebView's scrollView. I set the new height constraint constant of the WKWebView's frame bywebViewHeightConstraint.constant = initialHeight * scaleThe height of the WKWebView increases and since I used dynamic sizing cells, the table cell height will also adjust accordingly. 🙂That is UNTIL the zoom scale reaches a value close to 1.0 If it gets higher than this value, the content inside the WKWebView/scrollView gets white padding at the bottom.I suspect that this has to do with the Width/Height ratio of the WebView's frame being changed, since if the initial height of the WebView is greater than content height this will also happen. Another example would be if you open a webpage in Safari that has a content height of 300px but you stretched out the window to have a height of 100px, there would be white space at the bottom (or whatever &lt;body&gt; is set to)My questions is if there's a fix/workaround for the white bottom padding issue? If you look at an email thread in Mail on iOS you can zoom in and out of the emails and the cell heights adjust accordingly.
Posted
by eugenek.
Last updated
.
Post marked as solved
13 Replies
3.5k Views
Question: I downloaded and run the iOS application on a laptop with M1 processor System Info: macOS Montery 12.0.1,MacBook Pro (13-inch, M1, 2020) Steps to reproduce: Click any TextField, and then click the input box in WKWebView Prerequisite: Clear the cache and start the App for the first time The crash log is as follows: 2021-12-31 18:55:31.930622+0800 TestMacPro[57297:1269799] [default] could not create original path for node &lt;FSNode 0x60000247e600&gt; { isDir = ?, path = '/private/var/folders/rv/139v0xg52q59r657bxbsrbfc0000gp/X/82BBDE53-4B58-5C54-A1A4-90827962856E/d/Wrapper/TestMacPro.app' }, proceeding: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" 2021-12-31 18:55:32.074604+0800 TestMacPro[57297:1269799] Metal API Validation Enabled 2021-12-31 18:55:34.021293+0800 TestMacPro[57297:1269799] IOMFB: FigInstallVirtualDisplay not found 2021-12-31 18:55:34.021423+0800 TestMacPro[57297:1269799] iomfb_match_callback: primary 2021-12-31 18:55:34.021476+0800 TestMacPro[57297:1269799] iomfb_match_callback: external-0 2021-12-31 18:55:41.502881+0800 TestMacPro[57297:1269799] *** Assertion failure in void _NSWindowSetFrameIvar(NSWindow *, NSRect)(), NSWindow.m:932 2021-12-31 18:55:41.538942+0800 TestMacPro[57297:1269799] [General] An uncaught exception was raised 2021-12-31 18:55:41.539041+0800 TestMacPro[57297:1269799] [General] Invalid parameter not satisfying: &lt;SPRoundedWindow: 0x139fbbab0&gt;. "frame=!CGRectIsNull(frame)" 2021-12-31 18:55:41.539130+0800 TestMacPro[57297:1269799] [General] ( 0  CoreFoundation           0x00000001882f812c __exceptionPreprocess + 240 1  libobjc.A.dylib           0x0000000188049808 objc_exception_throw + 60 2  Foundation             0x000000018926ae20 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:] + 0 3  AppKit               0x000000018ae1ffbc -[NSWindow _reallySetFrame:] + 904 4  AppKit               0x000000018ae1f874 -[NSWindow _oldPlaceWindow:fromServer:] + 228 5  AppKit               0x000000018ae1e894 -[NSWindow _setFrameCommon:display:fromServer:] + 2200 6  SafariPlatformSupport        0x00000001ae618104 __85-[SPSafariPlatformSupport displayOTPAutoFillRelativeToRect:ofView:completionHandler:]_block_invoke + 300 7  SafariPlatformSupport        0x00000001ae617f8c -[SPSafariPlatformSupport displayOTPAutoFillRelativeToRect:ofView:completionHandler:] + 228 8  UIKitCore              0x00000001b00d6334 -[UIKeyboardImpl generateAutofillCandidateByAddingTask:] + 948 9  UIKitCore              0x00000001b00e03fc -[UIKeyboardImpl setDelegate:force:] + 6248 10 UIKitCore              0x00000001afdc62f4 -[UIKeyboardSceneDelegate _reloadInputViewsForKeyWindowSceneResponder:] + 2080 11 UIKitCore              0x00000001afdc5aa8 -[UIKeyboardSceneDelegate _reloadInputViewsForResponder:] + 164 12 UIKitCore              0x00000001af7394d8 -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 132 13 WebKit               0x00000001c102447c -[WKContentView(WKInteraction) _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:] + 2088 14 WebKit               0x00000001c0d354d4 _ZN6WebKit12WebPageProxy15elementDidFocusERKNS_25FocusedElementInformationEbbN3***9OptionSetIN7WebCore13ActivityState4FlagEEERKNS_8UserDataE + 216 15 WebKit               0x00000001c0f9bee8 _ZN6WebKit12WebPageProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 61312 16 WebKit               0x00000001c0993e24 _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_7DecoderE + 272 17 WebKit               0x00000001c0d041e8 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 40 18 WebKit               0x00000001c09763e0 _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_7DecoderENS1_14default_deleteIS3_EEEE + 808 19 WebKit               0x00000001c09759f0 _ZN3IPC10Connection24dispatchIncomingMessagesEv + 508 20 JavaScriptCore           0x00000001bfef8a40 _ZN3***7RunLoop11performWorkEv + 292 21 JavaScriptCore           0x00000001bfef9bb0 _ZN3***7RunLoop11performWorkEPv + 36 22 CoreFoundation           0x0000000188278bbc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 23 CoreFoundation           0x0000000188278b08 __CFRunLoopDoSource0 + 208 24 CoreFoundation           0x00000001882787f4 __CFRunLoopDoSources0 + 268 25 CoreFoundation           0x0000000188277168 __CFRunLoopRun + 820 26 CoreFoundation           0x0000000188276694 CFRunLoopRunSpecific + 600 27 HIToolbox              0x0000000190dec990 RunCurrentEventLoopInMode + 292 28 HIToolbox              0x0000000190dec704 ReceiveNextEventCommon + 552 29 HIToolbox              0x0000000190dec4c4 _BlockUntilNextEventMatchingListInModeWithFilter + 72 30 AppKit               0x000000018adcbaec _DPSNextEvent + 844 31 AppKit               0x000000018adca390 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1332 32 AppKit               0x000000018adbc3b0 -[NSApplication run] + 596 33 AppKit               0x000000018ad8da84 NSApplicationMain + 1064 34 AppKit               0x000000018b063ff0 +[NSWindow _savedFrameFromString:] + 0 35 UIKitMacHelper           0x000000019d764484 UINSApplicationMain + 1280 36 UIKitCore              0x00000001af5b2ce4 UIApplicationMain + 164 37 TestMacPro             0x0000000100d15bb4 main + 128 38 dyld                0x000000010102d0f4 start + 520 ) (lldb)
Posted
by Jinhao.
Last updated
.
Post not yet marked as solved
1 Replies
404 Views
I'm trying to embed a self-built copy of the WebKit frameworks to a macOS app. Most importantly I hope to get some features to work which Safari offers, but WKWebView in macOS doesn't (getDisplayMedia, Service Workers, WebInspector). Many years ago I was successful in using a self-built WebKit copy in this Mac app, but it seems the WebKit framework got more complex since them, I guess because of WKWebView's architecture. That time I had to open the projects for the main frameworks in Xcode, select the framework bundle in the target and change the "Installation Directory" setting to the path @executable_path/../Frameworks. After building WebKit using the build script, I could use otool -L to confirm the changed installation path, which then was displayed for example as @executable_path/../Frameworks/WebCore.framework/Versions/A/WebCore I tried the same with a current WebKit build: I copied the products for WebKit.framework, WebCore.framework, JavaScriptCore.framework, WebKitLegacy.framework, WebGPU.framework and WebInspectorUI.framework to my app and added it to the "Frameworks, Libraries and Embedded Content" section in the Project's Target/General tab and selected "Embed & Sign" for each framework. In "Build Phases" I made sure that WebCore.framework and WebGPU.framework are only in the "Copy Files" phase (Destination Frameworks) and not in "Link Binary with Libraries", as WebCore is linked through the WebKit umbrella framework and WebGPU gave another error (not sure about how to deal with that framework, as in the system it's in a PrivateFrameworks subfolder). In "Build Settings" I made sure that @executable_path/../Frameworks is entered for "Runpath Search Paths" (it was already probably because of Cocoapods, together with @loader_path/../Frameworks. When I build my app, the system's WebKit version is used. Only when I add the environment variable DYLD_FRAMEWORK_PATH with value @executable_path/../Frameworks in the run scheme, the embedded self-build WebKit frameworks are used. Because of currently necessary backward compatibility my app can use the legacy WebView or WKWebView. The legacy WebView works perfectly with the embedded WebKitLegacy.framework. But if I try to open any URL in WKWebView, no content is rendered and in the console output I can see: Safe Exam Browser[21391:145678] [Process] 0x10c67d760 - [PID=0] WebProcessProxy::didFinishLaunching: Invalid connection identifier (web process failed to launch) Safe Exam Browser[21391:145678] [Process] 0x10c67d760 - [PID=0] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=4 Safe Exam Browser[21391:145678] [ProcessSuspension] 0x10c005040 - [PID=0, throttler=0x10c67d8d8] ProcessThrottler::Activity::invalidate: Ending background activity / 'WebProcess initialization' Safe Exam Browser[21391:145678] [Process] 0x10c67d760 - [PID=0] WebProcessProxy::shutDown: Safe Exam Browser[21391:145678] [Process] 0x7fbe89064020 - [pageProxyID=40, webPageID=41, PID=0] WebPageProxy::processDidTerminate: (pid 0), reason 4 2022-02-14 12:53:01.764074+0100 Safe Exam Browser[21391:145678] [Process] 0x10c67d760 - [PID=0] WebProcessProxy::processTerminated: Safe Exam Browser[21391:145678] [Loading] 0x7fbe89064020 - [pageProxyID=40, webPageID=41, PID=0] WebPageProxy::dispatchProcessDidTerminate: reason=Crash Safe Exam Browser[21391:146842] [SEBOSXWKWebViewController webViewWebContentProcessDidTerminate:<Safe_Exam_Browser.SEBOSXWKWebView: 0x7fbe88f8b1c0>] I have the impression that the web process might fail to launch because I didn't embed all necessary parts of the self-built WebKit (the product folder contains a large number of XPC, dylib and .a files). Or some additional paths have to be adjusted before building WebKit, so that the embedded frameworks/libraries are used and not the system provided ones. I also looked at the bundle of the Safari Technology Preview and can see some similarities but also differences. I would be grateful if anybody could provide me with information how to embed a self-built copy of WebKit into a macOS app. Unfortunately I didn't find any Mac open source browser using an embedded copy of WebKit to get some inspiration from.
Posted
by dansch.
Last updated
.
Post not yet marked as solved
1 Replies
234 Views
My app loads a webview using WKWebView class, so it uses safari to render the web content. However, the content is quite complex and Chrome does perform considerably better than Safari. So i wonder if would be possible to use Chrome engine in WKWebview, instead of Safari.
Posted Last updated
.
Post not yet marked as solved
0 Replies
179 Views
Safari freezes when we try to use canvas.putImageData to draw image to canvas. Safari version is 15. happen in MacOs and iPad. I have made a reproduction here. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> * { padding: 0; margin: 0 } html,body { width: 100%; height: 100%; } </style> </head> <body> <div> <button id="btn"> get random number </button> <button id="btn2"> open a tab </button> </div> </body> </html> <script> let i = 1; const btn = document.querySelector('#btn'); const btn2 = document.querySelector('#btn2'); const urls =  ['https://st-gdx.dancf.com/gaodingx/0/uxms/design/20210914-213851-d8b8.png']; urls.length = 1; btn.onclick = () => { console.time('click'); btn.innerHTML = Math.random(); console.timeEnd('click'); } btn2.onclick = () => { window.open(window.location.href); } for(let i = 0; i < urls.length; i++) { const img = new Image(); img.src = urls[i]; img.crossOrigin = 'anycrossorign'; img.onload = () => { const canvas = document.createElement('canvas'); canvas.width = 1000; canvas.height = 1000; const ctx = canvas.getContext('2d'); ctx.drawImage(img, 0, 0); const pixels = ctx.getImageData(0, 0, 1000, 1000); for (let i = 0; i < pixels.data.length; i += 4) { pixels.data[i + 3] = 255; } ctx.putImageData(pixels, 0, 0, 0, 0, 1000, 1000); document.body.appendChild(canvas); } } </script>
Posted
by juanbai.
Last updated
.
Post not yet marked as solved
2 Replies
177 Views
I'm adding a WKWebView to my (Mac) app, and it works fine except that the navigationDelegate is never called. Even stranger, if that delegate implements decidePolicyForNavigationAction, that method is never called either, but as a side effect the view now won't load any pages! In detail: I've created a class implementing WKNavigationDelegate, I've implemented some of the methods, and assigned an instance to the view's navigationDelegate property. Easy stuff. I've done this in the past using the old-school WebView class. I've triple-checked my work. As an experiment, I added a -respondsToSelector: method to my delegate class and made it log the selector. I see it being called several dozen times, with the selectors for all of the delegate methods and many other private(?) methods; so I know WebKit sees my object. It just never calls it at all. My hunch so far is that this is an OS bug, that Apple no longer bothers to test WebKit APIs in Objective-C. I'd hate for that to be true. (I realize Obj-C is basically deprecated nowadays. I'm using it because my non-UI code is all in C++, and it's vastly easier to integrate with C++ in Obj-C. To use Swift I'm going to have to wrap my API in C functions, yuck.)
Posted
by snej.
Last updated
.