Unable to create a cookie using WebKit API or manually create a cookie in Safari with SameSite=None on a device using iPadOS 18 beta. In Safari, the None option is still in the drop down as a selection for SameSite which leads me to believe this is a bug. Is this going to be fixed in the release version of iOS 18?
WebKit
RSS for tagDisplay web content in windows and implement browser features using WebKit.
Posts under WebKit tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Currently on Xcode 15.4 in a SwiftUI App when you attach a UIView to the rootViewControllers view, which contains a WKWebView, the view will display and allow interaction to it (i.e opening new pages/pressing buttons). However in Xcode 16 beta 4 this is no longer the case. The view will still appear but will no longer be interactive. This happens only on iOS 18 Beta (1-7) and iOS 18.1 Beta.
When voiceover is turned on in IOS devices the video controls like pause/resume, forward , backward are not working in
inline mode and works fine in fullscreen.
The controls are announced properly in voiceover,but when we press it, it is not performing any action at all.
We used HTML5 video tag to display mp4 video in our app.we have added all necessary accessibility tags as well.
We also observe the same issue is happening in the w3school web page. Attaching the link here for reference. (https://www.w3schools.com/html/tryit.asp?filename=tryhtml5_video)
Could you please guide us why the video controls are not working. Is there anything we want to change or any update needed from the safari side.
I have a few pdfs that contains images/grayscale images that opened properly on my app with IOS 16.5 but since upgrading to 17.5, the app crashes with “A problem has repeatedly occured on...” this means the IOS itself is not able to handle the pdf otherwise we would get an error from our app.
Previously, while we got a warning in the console saying that the max canvas has been exceeded. The app did not crash.
Would it be possible to know what was the changes coming in version 17.0+ that could have caused this? And if so, should this be a bug that gets fixed? I’ve looked at the release note and can’t pinpoint which changes could have caused this new behaviour. This occurs on safari and chrome.
以下是包含完整日誌的回報範本:
Title: WKWebView File Upload Causes App Crash When Selecting Camera or Recording Options
Body:
Hello,
I am experiencing a critical issue with WKWebView in our iOS app when handling file uploads. We are using the following HTML element to allow users to capture images or videos, select from their photo library, or choose a file from the file system:
<input type="file" accept="image/*;capture=camera" id="cameraInput">
Issue Description:
When a user selects the camera or recording option, the app immediately crashes and returns to the WKWebView screen. This issue does not occur when selecting a file from the photo library or file system.
Logs:
Below are the relevant logs captured when the issue occurs:
Presenting view controller <_UIContextMenuActionsOnlyViewController: 0x1034349e0> from detached view controller <MailVwCtl: 0x103838800> is not supported, and may result in incorrect safe area insets and a corrupt root presentation. Make sure <MailVwCtl: 0x103838800> is in the view controller hierarchy before presenting from it. Will become a hard exception in a future release.
RotateN2:<MailVwCtl: 0x103838800>
RotateN2:<MailVwCtl: 0x103838800>
RotateN1:<Mail2000ViewController: 0x10350b780>
RotateN2:<Mail2000ViewController: 0x10350b780>
RotateN2:<MailVwCtl: 0x103838800>
RotateN2:<MailVwCtl: 0x103838800>
RotateN2:<Mail2000ViewController: 0x10350b780>
RotateN1:<Mail2000ViewController: 0x10350b780>
RotateN2:<Mail2000ViewController: 0x10350b780>
RotateN2:<Mail2000ViewController: 0x10350b780>
RotateN2:<Mail2000ViewController: 0x10350b780>
RotateN2:<Mail2000ViewController: 0x10350b780>
Unknown chipRevisionID (0xffffffff)
Attempted to change to mode Portrait with an unsupported device (BackWideDual). Auto device for both positions unsupported, returning Auto device for same position anyway (BackAuto).
Attempted to change to mode Portrait with an unsupported device (BackWideDual). Auto device for both positions unsupported, returning Auto device for same position anyway (BackAuto).
Attempted to change to mode Portrait with an unsupported device (BackAuto). Auto device for both positions unsupported, returning Auto device for same position anyway (BackAuto).
Attempted to change to mode Portrait with an unsupported device (BackWideDual). Auto device for both positions unsupported, returning Auto device for same position anyway (BackAuto).
RotateN2:<Mail2000ViewController: 0x10350b780>
RotateN2:<Mail2000ViewController: 0x10350b780>
RotateN2:<Mail2000ViewController: 0x10350b780>
WillDsAr:<MailVwCtl: 0x103838800>
RotateN1:<Mail2000ViewController: 0x10350b780>
RotateN2:<Mail2000ViewController: 0x10350b780>
DidDsAr:<MailVwCtl: 0x103838800>
<Mail2000ViewController: 0x10350b780>:VwWillAppear:1:x0
willAr:1,Fm:0,20,375,792-<MailVwCtl: 0x103838800>
willAr:1,Bd:0,0,375,792-<MailVwCtl: 0x103838800>
<MailVwCtl: 0x103838800>:VwDidAP:
VwDidAP:Bd:0,0,375,792-<MailVwCtl: 0x103838800>
VwDidAP:Fm:0,20,375,792-<MailVwCtl: 0x103838800>
VwDiDAP:SetFm:0,20,375,792-<MailVwCtl: 0x103838800>
ToolVwSetVwSize0:main,0,24,w=375,h=668,stepInd=0
ToolVwSetVwSize0:toobar_self,0,692,w=375,h=66
ToolVwSetVwSize:w=375,h=792
ToolVwSetVwSize1:main,0,0,w=375,h=727
ToolVwSetVwSize1:ToolBar,0,727,w=375,h=792
RotateN2:<Mail2000ViewController: 0x10350b780>
RotateN2:<Mail2000ViewController: 0x10350b780>
<Mail2000ViewController: 0x10350b780>:VwDidAppear:1:x0
M2KVC_DidAp0:0.000000 0.000000 375.000000 812.000000
Additional Context:
This issue is critical as it affects the user experience severely. Notably, we have a similar issue in our Android app using WebView. In that case, the file upload options for camera, recording, and file selection do not appear at all, restricting users to only upload files from the phone's storage.
We would like to inquire whether there have been recent changes to the APIs related to WKWebView and WebView or any known issues that could be causing this behavior. We are also concerned this might be a side effect of recent bug fixes or updates to WKWebView.
Additional Context:
This issue appears to be specific to iOS 17. We have tested the same functionality on devices running iOS versions below 17, and the camera and recording options work as expected without any crashes. This suggests that the issue may be introduced in iOS 17.
You can view a video demonstrating the issue at this link:
https://share.icloud.com/photos/001voevXriVXsEUmhzGsFBtSA
Environment:
iOS version: 17.6.1&17.5.1
Device: iPhone 15 Pro Max& iPhone 12
WKWebView version: [Your WKWebView version, if known]
App platform: iOS
Xcode version: 15.1
We appreciate any insights or guidance you can provide on this matter.
Thank you.
When using wkwebview to load a web page for audio and video calls in iPhone and Mac apps, the permission box will pop up every time after reconstruction of wkwebview, affecting the user's use, is there any way to make the permission pop-up box only pop up for the first time, like app permision pop-up window,instead of popping up every time. If you have previously authorized the permission, even after the app is restarted, do not pop up the permission prompt box in the webview.
Hello everyone,
I am currently developing several Progressive Web Apps (PWAs) and I am wondering if it’s possible to programmatically open an installed PWA on iOS/iPadOS from another app or a link.
My goal is to be able to launch an installed PWA directly from an action in another PWA, a web app, or a native app on iOS. For example, I’d like to know if this can be achieved via a deep link, a custom protocol (web+), or any other mechanism available on these platforms.
Has anyone successfully implemented this feature or found a workaround to programmatically open an installed PWA on iOS/iPadOS?
Thank you very much for your feedback and suggestions!
If you create a cookie and add to the WKWebViewConfiguration the completionHandler returns 'Cookies synced' suggesting cookie was added with success. However, upon inspection of app in Safari the cookie is not there. This is broken in iOS 18 beta and works in previous versions without issue. Did Apple change the WKWebView API and break this feature?
code snippet:
NSDictionary* settings = self.commandDelegate.settings;
WKWebViewConfiguration* configuration = [self createConfigurationFromSettings:settings];
configuration.userContentController = userContentController;
NSMutableDictionary *cookieProperties = [NSMutableDictionary dictionary];
[cookieProperties setObject:@"foo" forKey:NSHTTPCookieName];
[cookieProperties setObject:@"bar" forKey:NSHTTPCookieValue];
[cookieProperties setObject:@"mydomain.com" forKey:NSHTTPCookieDomain];
[cookieProperties setObject:@"mydomain.com" forKey:NSHTTPCookieOriginURL];
[cookieProperties setObject:@"/" forKey:NSHTTPCookiePath];
NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:cookieProperties];
[configuration.websiteDataStore.httpCookieStore setCookie:cookie completionHandler:^{NSLog(@"Cookies synced");}];
WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:self.engineWebView.frame configuration:configuration];
On iOS18 Beta 3 Version, Unable to load a javascript file from Salesforce in the WebView.
When trying to load a javascript file (static resource) from Salesforce in WebView. It's throwing below mentioned error.
Error: Refused to execute https://*.my.salesforce.com/resource/1722959303321/T1C_Base__DealsLib/src/ace-lib.js as script because "X-Content-Type-Options: nosniff" was given and its Content-Type is not a script MIME type.
The error is only happening after upgrading to iOS18 Beta. It was working fine before.
Expected Behaviour: File should be loaded successfully
Actual Behaviour: File is not loading
Xcode Version: 15.3
0
WebCore
0x00000001a90d4000 + 2488784
1
WebCore
0x00000001a90d4000 + 2488688
2
WebCore
0x00000001a90d4000 + 2099672
3
WebCore
WebCore::Document::resolveStyle(WebCore::Document::ResolveStyleType) + 696
4
WebCore
WebCore::Document::updateStyleIfNeeded() + 264
5
WebCore
0x00000001a90d4000 + 1066556
6
WebCore
0x00000001a90d4000 + 1070640
7
CoreFoundation
_CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 32
8
CoreFoundation
___CFRunLoopDoTimer + 1012
9
CoreFoundation
___CFRunLoopDoTimers + 288
10
CoreFoundation
___CFRunLoopRun + 1856
11
CoreFoundation
_CFRunLoopRunSpecific + 572
12
UIFoundation
-[NSHTMLReader _loadUsingWebKit] + 1420
13
Foundation
___NSThreadPerformPerform + 264
14
CoreFoundation
_CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28
15
CoreFoundation
___CFRunLoopDoSource0 + 176
16
CoreFoundation
___CFRunLoopDoSources0 + 244
17
CoreFoundation
___CFRunLoopRun + 840
18
CoreFoundation
_CFRunLoopRunSpecific + 572
19
GraphicsServices
_GSEventRunModal + 164
20
UIKitCore
-[UIApplication _run] + 816
21
UIKitCore
_UIApplicationMain + 340
Recently monitoring a lot of iOS 18 beta 5(22A5326f) crashes about WKWebView, anyone know how to fix it?
OS Version: iPhone OS 18.0 (22A5326f)
Report Version: 104
Exception Type: SIGABRT
Exception Codes: #0 at 0x1d787e254
Crashed Thread: 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSRangeException', reason: 'NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds'
Last Exception Backtrace:
0 CoreFoundation 0x000000018781c08c 0x187798000 + 540812
1 libobjc.A.dylib 0x0000000184b232e4 0x184b0c000 + 94948
2 Foundation 0x00000001864024cc 0x1863d0000 + 206028
3 WebKit 0x000000019db987a0 0x19cdc0000 + 14518176
4 WebKit 0x000000019db97fec 0x19cdc0000 + 14516204
5 UIKitCore 0x000000018af741e0 0x189f6c000 + 16810464
6 UIKitCore 0x000000018ac13518 0x189f6c000 + 13268248
7 UIKitCore 0x000000018a901050 0x189f6c000 + 10047568
8 UIKit 0x00000002404643f8 0x24044e000 + 91128
9 UIKitCore 0x000000018a9007e8 0x189f6c000 + 10045416
10 UIKitCore 0x000000018a920e38 0x189f6c000 + 10178104
11 UIKitCore 0x000000018a9040c4 0x189f6c000 + 10059972
12 UIKitCore 0x000000018a905040 0x189f6c000 + 10063936
13 UIKitCore 0x000000018a419834 0x189f6c000 + 4905012
14 UIKitCore 0x000000018a4196c8 0x189f6c000 + 4904648
15 Foundation 0x000000018647783c 0x1863d0000 + 686140
16 CoreFoundation 0x00000001877ef088 0x187798000 + 356488
17 CoreFoundation 0x00000001877ef01c 0x187798000 + 356380
18 CoreFoundation 0x00000001877ecb08 0x187798000 + 346888
19 CoreFoundation 0x00000001877ebd04 0x187798000 + 343300
20 CoreFoundation 0x00000001877eb5b8 0x187798000 + 341432
21 GraphicsServices 0x00000001d34f31c4 0x1d34f2000 + 4548
22 UIKitCore 0x000000018a34ada0 0x189f6c000 + 4058528
23 UIKitCore 0x000000018a3f917c 0x189f6c000 + 4772220
24 CMBMobile 0x000000010066f384 main + 4486020 (main.m:301)
25 ??? 0x00000001ad2e0d34 0x0 + 0
So I have an ios app using wkwebview - ionic framework, my images (not local and hosted) can be seen in ios 17 in my app but not in ios 18.
Is there some changes in wkwebview for this particular thing or am I missing something else?
We have tested on iPhone 12 Pro and observed that Safari allowed approximately 1.5GB of RAM usage. Page refreshes when trying to allocate more memory. After performing a hard reset and erasing all content, I noticed that Safari allowed approximately 3GB of RAM usage for our webpage. However, after 2-3 days, the maximum allowable RAM usage in Safari decreases to about 1.5GB. Once 1.5GB limit is reached, the system reloads the page.
To further investigate, I performed another hard reset on my device, and once again, Safari allowed around 3GB of RAM usage.
Additionally, we tested this on iPhone 15 Pro and 15 Pro Max, where the RAM limitation in Safari is consistently around 3GB (page is reloading after reaching 3GB).
Could you please clarify why the memory limit fluctuates after hard reset? Is there any specific setting or flag within Safari or iPhone that controls the maximum RAM usage, which could be causing this behavior?
I also posted the issue there: https://bugs.webkit.org/show_bug.cgi?id=277848
I would appreciate any guidance or potential solutions to this issue. If this is a known limitation or issue, understanding the root cause would be extremely helpful.
Thank you for your attention to this matter.
Model Name: iPhone 12 Pro
iOS Version: 17.5.1
Capacity: 128gb
I'm curious about the new app icon options (any, dark, tinted) for Progressive Web Apps in iOS / iPadOS 18.
Has this feature been implemented yet?
If so, could someone point me to the specific documentation?
I've searched the Apple Developer Forums, Google, and Reddit but couldn't find any relevant information.
Thanks!
We are encountering a crash that occurs more frequently on iOS 18 beta 3 and beta 4. The crash happens suddenly after startup and does not provide a detailed code stack trace. Additionally, we have noticed that WebKit has a new version with fixes available. Could you let us know when this update will be released?
webkit has fix this crash: https://github.com/WebKit/WebKit/commit/03200a8c08079e188c3de7a97109a51202cc6c64
https://bugs.webkit.org/show_bug.cgi?id=276620
Thread 1 Queue : com.apple.main-thread (serial)
#0 0x00000001921c7008 in objc_msgSend ().
#1 0x00000001f2848938 in **::Detail::CallableWrapper<WebViewRenderingUpdateScheduler::WebViewRenderingUpdateScheduler(WebView)::$_1, void>::call() ()
#2 0x0000000194e7bf74 in CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION ().
#3 0x0000000194e7bd18 in __CFRunLoopDoObservers ().
#4 0x0000000194eaac80 in __CFRunLoopRun ()
#5 0x0000000194eaa4c8 in CFRunLoopRunSpecific ().
#6 0x00000001e172d1c4 in GSEventRunModal ().
#7 0x00000001979f4a90 in -[UIApplication _run] ()
#8 0x0000000197aa2d1c in UIApplicationMain ().
#9 0x00000001023f4064 in main at /Users/Dragon/Desktop/App/qrn-ios//main.m:14.
#10 0x00000001bb60e9b4 in start ().
detail info is below:
SIGSEGV: 0xffffff81ece07608 0x0 + 8268181504
main.
0 0 0x00000001018de5c8 -[CKCrashReporter recordCrashWithSignal:].
1 1 0x00000001018e15cc SignalHandler.
2 2 libsystem_platform.dylib 0x000000021716fafc 93D52E6D-C21D-3BC4-9C49-EBF71987F78C + 8977309696
3 3 WebKitLegacy 0xffffff81ece07608 0x0 + 8268181504.
4 4 WebKitLegacy 0x00000001ece07608 5BEE83EA-6DB3-357D-A484-0555DAE5C1B8 + 8268181504.
5 5 CoreFoundation 0x000000018fbd6e14 7AD2298D-5B8F-3AF4-9EED-B09B8E0A9653 + 6706372608.
6 6 CoreFoundation 0x000000018fbd6bb8 7AD2298D-5B8F-3AF4-9EED-B09B8E0A9653 + 6706372608.
7 7 CoreFoundation 0x000000018fc05bd8 7AD2298D-5B8F-3AF4-9EED-B09B8E0A9653 + 6706372608.
8 8 CoreFoundation 0x000000018fc05368 CFRunLoopRunSpecific + 6706372608.
9 9 GraphicsServices 0x00000001dbdf81c4 GSEventRunModal + 7983820800.
10 10 UIKitCore 0x00000001927529b0 D2E47210-1C46-3CA7-BBC2-35021B146A13 + 6748045312.
11 11 UIKitCore 0x00000001928 00d54 UIApplicationMain + 6748045312.
12 12 0x00000001000b4080 main.
13 13 dyld 0x00000001b5e40734 94AF19E0-4F2A-332F-A08C-04B9B7CB6FAC + 210740.
I'm trying to mimic glossy, semi-transparent blurry backgrounds for my visionOS app inside of WKWebView
It's easy to do for menus like on the screenshot below, using semitransparent background and applying backdrop-effect: blur(20px)
The problem I have is when I make the whole window like this by specifying webView.isOpaque = false and applying to body background-color: transparent. In this case, suddenly, the backdrop-effect: blur stops working for menu. See picture below:
You can clearly see that blur is not working anymore since you can see 3 dots behind the menu. I did not touch any CSS properties for the menu itself, only making the whole window semi-transparent.
Is there any workaround for this problem? For me it's a blocker to make UI to feel native to visionOS.
I created a simple web browser using WKWebView, but as far as I can tell, there is not a way to auto-populate credentials or save credentials a user enters into a login form at a 3rd-party website like Netflix (i.e., not my own app domain).
Is this correct?
If this is wrong, what are the APIs to support this?
My use case is that I want to create an immersive app in visionOS that includes a window that lets the user surf the web (among other things). Ideally, I could just use a Safari window in my immersive app, but I don't think this is possible either. My work around is to create my own web browser... which works, minus the credential issue.
Is it possible to bring a Safari window into an immersive visionOS app's experience? (IMHO, that would be a great feature)
Hi, I am developing an app that has a WKWebView and it can open sites like Youtube. The app is sandboxed as it is meant to be uploaded to the mac App Store. It has a feature PiP where we start the native PiP by calling a browser Javascript where we tell the WKWEBView to fire the PiP. It works well when we are running the code from XCODE in Debug scheme. When we run the code from release mode by archiving it or directly from the build folder, the WKWebView is not able to fire the PiP Agent and thus the Native PiP window is not visible, while the site shows that PiP is opened and we can here the sound being played. But PiP window is not visible. I cannot see PiPAgent in activity monitor. Why does it not work from within the release build outside xcode. But when I try to run the build directly from the Finder in builds folder, this PiP feature does not work. Request technical help for this. Thanks!
Dear Apple Support Team,
Upon upgrading to iOS 18, I have noticed a marked change in the character spacing of the PingFang font when rendered by WebKit, the web content rendering engine utilized by Safari and other web views in iOS. Specifically, the spacing between characters appears to have increased or altered in a manner that is not consistent with previous iOS versions or with the font's specifications as defined in CSS. This issue has significantly impacted the visual presentation of my web pages, causing a notable deviation from the intended design and potentially affecting user experience.
Expected Behavior:
The character spacing of PingFang font in WebKit on iOS 18 should maintain consistency with previous versions or adhere strictly to CSS specifications, ensuring a seamless transition for web developers and end-users alike.
Request for Assistance:
Could you please investigate this issue and confirm if it is a known bug or an intentional change in iOS 18? If it's a bug, could you provide an estimated timeline for a fix or a workaround that we can implement in the meantime? Additionally, any guidance on how to best address this issue in our H5 content, such as alternative font choices or CSS hacks, would be greatly appreciated. Thank you for your attention to this matter. We value the stability and consistency of the WebKit engine and the overall iOS platform, and we look forward to your prompt response and resolution.
In my project, I'm using the WKWebView to display the Google OAuth popup. And after it appears, the JS window.opener is null, and because of that the original window cannot receive an auth token in a callback. This works perfectly fine in iOS 17.0 and earlier, but broken starting from 17.5. I've tested on the 18.0 too - same results the opener is always null no matter what I try.
Web Part:
<html>
<head>
<script src="https://accounts.google.com/gsi/client" async></script>
</head>
<script type="text/javascript">
var global = {};
window.addEventListener("message", function (ev) {
console.log("=== Event Listener ===");
console.log(ev);
});
function client() {
if (global.client === undefined) {
global.client = google.accounts.oauth2.initTokenClient({
client_id: '<client_id>',
scope: 'https://www.googleapis.com/auth/userinfo.email \
https://www.googleapis.com/auth/userinfo.profile',
callback: function (responseToken) {
console.log("=== Callback ===");
console.log(responseToken);
let auth = document.getElementById("auth");
auth.textContent = 'Token: ' + responseToken.access_token
}
});
}
return global.client;
}
function googleOauthClient() {
console.log("Trying to login");
let auth = document.getElementById("auth");
auth.textContent = 'In Progress...';
client().requestAccessToken();
}
</script>
<body>
<div id="center">
<a onclick="googleOauthClient()"><h1>Google Login Attempt</h1></a>
<h2 id="auth"></h2>
</div>
</body>
</html>
In iOS showing popup is implemented as:
#import "WebViewController.h"
#import "SafariServices/SafariServices.h"
@interface WebViewController () <WKNavigationDelegate, WKUIDelegate> {
WKWebView *web;
WKWebView *popupWebView;
}
@end
@implementation WebViewController
- (void)loadView {
[super loadView];
WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
[[config preferences] setJavaScriptEnabled:YES];
[[config preferences] setJavaScriptCanOpenWindowsAutomatically:NO];
[[config defaultWebpagePreferences] setAllowsContentJavaScript:YES];
[config setAllowsInlineMediaPlayback:YES];
web = [[WKWebView alloc] initWithFrame:self.view.frame configuration:config];
[web setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
[web setAllowsLinkPreview:YES];
[web setNavigationDelegate:self];
[web setUIDelegate:self];
[web setInspectable:YES];
[web setCustomUserAgent:[[web valueForKey:@"userAgent"] stringByAppendingString:@" Safari"]];
[[self view] addSubview:web];
}
- (void)viewDidLoad {
[super viewDidLoad];
NSString *url = @"http://localhost:8080/oauth"; // A simple Spring Boot App where HTML is hosted
[web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
}
- (void)webView:(WKWebView *)webView
decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
decisionHandler(WKNavigationActionPolicyAllow);
}
- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures {
if (navigationAction.targetFrame == nil) {
popupWebView = [[WKWebView alloc] initWithFrame:webView.frame configuration:configuration];
[popupWebView setCustomUserAgent: [webView customUserAgent]];
[popupWebView setUIDelegate:self];
[popupWebView setNavigationDelegate:self];
[popupWebView setInspectable:true];
[[[popupWebView configuration] defaultWebpagePreferences] setAllowsContentJavaScript:YES];
[[[popupWebView configuration] preferences] setJavaScriptCanOpenWindowsAutomatically:NO];
[[[popupWebView configuration] preferences] setJavaScriptEnabled:YES];
[[popupWebView configuration] setSuppressesIncrementalRendering:YES];
[webView addSubview:popupWebView];
[popupWebView loadRequest:[navigationAction.request copy]];
return popupWebView;
}
return nil;
}
- (void)webViewDidClose:(WKWebView *)webView {
[webView removeFromSuperview];
popupWebView = nil;
}
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error {
NSLog(@"didFailProvisionalNavigation: %@", [error description]);
}
- (void)webView:(WKWebView *)webView didFailNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error {
NSLog(@"didFailNavigation: %@", [error description]);
}
- (void)webView:(WKWebView *)webView requestMediaCapturePermissionForOrigin:(WKSecurityOrigin *)origin initiatedByFrame:(WKFrameInfo *)frame
type:(WKMediaCaptureType)type decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandler {
decisionHandler(WKPermissionDecisionGrant);
}
- (void)webView:(WKWebView *)webView requestDeviceOrientationAndMotionPermissionForOrigin:(WKSecurityOrigin *)origin
initiatedByFrame:(WKFrameInfo *)frame decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandler {
decisionHandler(WKPermissionDecisionGrant);
}
- (void)webView:(WKWebView *)webView runOpenPanelWithParameters:(WKOpenPanelParameters *)parameters
initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSArray<NSURL *> * _Nullable URLs))completionHandler {
completionHandler(nil);
}
@end
What I tried so far:
Disabled in the Settings -> Safari -> Cross-Origin-Opener-Policy;
Disabled popup blocking;
Added Allow Arbitrary Loads to Info.plist (actually added all possible security policies);
This actually works in the SFSafariViewController, but I cannot use it because I need to hide the Navigation and Status bar panels.
How it looks in 17.0
vs 17.5
And ideas about what I might be doing wrong? Or maybe some workaround I can utilize to get the Google OAuth token from the popup. Thanks in advance.