My website is using a lot of memory. JavaScript Allocations Timeline shows that js occupies 130MB. However, instruments show that the overall memory usage of webview reaches 480MB. I would like to know if there is any tool to analyze the distribution of this 480MB of memory usage.
Web Inspector
RSS for tagDiscuss Web Inspector, which gives you quick and easy access to the richest set of development tools ever included in a web browser.
Posts under Web Inspector tag
13 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I have a hybrid mobile app which loads web server screens in its iframe(which is under the WKWebView); an https request is initiated from the mobile app to the web server which returns the html page to be loaded in the iframe.
The calls which are initiated from outside the iframe have cookies maintained in their requests, while the ones initiated from inside the iframe(web server page) loose the cookies and do not inherit them in IOS beta 18 while It worked fine in the previous IOS versions.
Anybody has infos about this or similar cases?
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];
When we activate the developer options and right-click to select "Inspect," then navigate to the Network tab, we can view the request entries.
However, upon clicking on an entry, I can see the headers, cookies, and other details, but one crucial aspect is absent: the request and response data. This seems like a fundamental feature—why is it missing? 🤔
Problem Details :
In the case of iOS, the image to be displayed in the pop-up message within the TypeScript application does not appear during file download.
An error occurred trying to load the resource when attempting to fetch the image (in the case of Safari).
The image does not appear in Edge or Chrome either, besides Safari. The image is displayed correctly on Windows 10, 11, Mac Ventura, Mac Sonoma, and Android.
Neither svg format nor png format images are displayed.
Only in the case of iOS, a download modal appears in Safari (In Edge and Chrome, a different display asking whether or not to download appears, which is different from the modal).
The issue only occurs when the download modal display and the image fetching for the pop-up are conducted simultaneously. If you delay the display of the download modal from the timing of fetching the image for the pop-up (apply a wait), the image can be fetched.
Verification Environment:
iOS v.17.5.1 Safari 604.1
iOS v.17.3 Safari 604.1
IOS v.17.4.1 Chrome 126.0.6478.54
IOS v.17.4.1 Edge: 125.0.2535.72
Consideration and Request:
Based on the problem details, I am considering that this issue might be a bug in iOS.
I would like to know from experts whether this event is a bug or a specification of iOS.
If there is any information about similar events occurring, I would like to know.
If there are any solutions, hints, or advice, I would appreciate it if you could provide them.
If additional information is required from me, I would like to be contacted.
Thank you for your cooperation.
Issue Summary:
I have encountered an issue where JavaScript does not execute in a WebView when another UIViewController is presented modally with modalPresentationStyle.fullScreen. This problem only occurs on physical devices running iOS 17.5.1. The issue is not present on iOS 17.5 simulators or devices running iOS 17.4.1 or earlier.
Reproduction Steps:
Create a ViewController with a WebView.
Load a web page (e.g., https://apple.com) in the WebView.
Present another ViewController modally with modalPresentationStyle.fullScreen.
Verify that JavaScript execution in the initial WebView stops working.
Test Code:
import UIKit
import WebKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Set up the WebView
let configuration = WKWebViewConfiguration()
let webView = WKWebView(frame: view.frame, configuration: configuration)
view.addSubview(webView)
webView.frame = view.frame
if #available(iOS 16.4, *) {
webView.isInspectable = true
} else {
// Fallback on earlier versions
}
webView.load(URLRequest(url: URL(string: "https://apple.com")!))
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let navigationController = UINavigationController(rootViewController: TargetViewController())
navigationController.modalPresentationStyle = .fullScreen
present(navigationController, animated: true)
}
}
class TargetViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Set up the WebView
let webView = WKWebView(frame: view.frame, configuration: WKWebViewConfiguration())
view.addSubview(webView)
webView.frame = view.frame
if #available(iOS 16.4, *) {
webView.isInspectable = true
} else {
// Fallback on earlier versions
}
webView.load(URLRequest(url: URL(string: "https://apple.com")!))
}
}
Observations:
The JavaScript within the WebView stops executing only on physical devices running iOS 17.5.1.
This issue does not occur on the iOS 17.5 simulator.
Devices running iOS 17.4.1 or earlier do not experience this issue.
Request for Assistance:
Could you please provide any insights or potential workarounds for this issue? Additionally, if this is a known bug, any information on upcoming fixes would be highly appreciated.
Thank you.
M1 Air, Sonoma., Books.app. How to open an inspector? old method
defaults write com.apple.iBooksX WebKitDeveloperExtras -bool YES
doesn't work
On ios15, when loading a page, occasionally all resources under a domain name cannot be loaded.
the code like this:
<html><head>
<title>issue page</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
</style></head>
<body><div>
<script type="text/javascript" src="https://wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script type="text/javascript" src="https://wap.xxxx.com/static/webapp/common_res/3rd/jquery-3.6.2.min.js"></script>
<script type="text/javascript" src="https://statres.ok.com/quickapp/js/qa_router.min.js"></script>
<script type="text/javascript" src="https://wap.xxxx.com/static/webapp/common_res/js/utils.min.js"></script>
</div></html>
This is a simplified page code.
The problem is that the page cannot be loaded. Resources under wx.qq.com and statres.ok.com can be loaded, but all resources under wap.xxxx.com fail to be loaded. (Debugging via safari)
wkwebview did not call back to didFinishNavigation, and the page load progress was stuck at 0.5. And then it didn't go out of time. It just stayed there.
Here are some of the solutions I tried:
1、At first I thought it was a resource problem, but everything worked fine when I copied it to safari. In addition, most of the time in my page is fine, but once this problem occurs, the page will no longer load out until I restart the app.
2、thought is to cache problem, repetition, I added NSURLRequestReloadIgnoringLocalCacheData, also was not used.
3、 I captured the system logs through idevicesyslog and found no obvious anomalies in webkit.
4、When I used wireshark to find the problem, wap.xxxx.com did not even initiate dns requests, as if the browser ignored the resource.(Normally, I caught the dns request for this page)
Please help me divergent ideas, thank you!
Hi all,
I deployed a static site and two of my imgs are not appearing on some iPhones. It's not showing up on my iPhone 15 Pro but it's appearing on an iPhoneSE and androids. When I long click them, they actually show up in preview and can even open the images in a different tab, so they're just transparent. Does anyone have any idea why this is happening?
After insert this script I can't see the property window.app.isNative = true on Safari, What I'm missing here? Thanks in advance
userContentController.addUserScript(WKUserScript(source: """function() {
if (!window.app) {
window.app = {};
}
window.app.isAndroid = false;
window.app.isIOS = true;
window.app.isNative = true;
originWhitelist={['*']}
}
""", injectionTime: .atDocumentStart, forMainFrameOnly: true))
I've been having a hard time getting WebXR testing working in VisionOS. I had Ventura and installed VisionOS 1.0 and video crashed launching to WebXR. To get 1.1 I did alot of jumps to get XCode 15.3 beta and VisionOS 1.1 requiring to also upgrade to macOS Sonoma.
In Ventura I was able to web inspect Safari in VisionOS 1.0 but in Sonoma, and VisionOS 1.1 I get "No Inspectable Applications"
I have tried Safari and Preview Safari.
I have a web application built in NextJS that I use cookies to handle persisting authentication details. I clear the cookies on logout and this works in other browsers.
However, when I run this on Safari, it seems the browser is caching the cookie information. When I use the Safari debugger, I do not see the cookies in the Storage view, however, when I use document.cookies, I can retrieve them fine - which should not happen. This is not the case in Chrome.
I can't find any information on this online, so any help or insights would be greatly appreciated.
We have a challenge with Webview when load our application URL.
Initial call we are passing all the information with token and its works fine, but we are getting 401- unauthorized for some of the subsequent redirect request while loading webview.
looks like server is expecting auth tokens for all the redirect/subsequent request.
we are not able to intercept the request to add the token for all the requests.
is there any possible solution to fix this issue?
Thanks