Questions tagged [wkurlschemehandler]
18 questions
15
votes
2 answers
How to intercept a WKWebView request to detect which local resource files (css, js, png, ...) load together with a HTML file?
I have a HTML file which contains local resource files such as css, js and png files inside its content. These local resource files are in zip format. My app use WKWebView to display this html file. I want to find a solution to intercept the web…

Tony Pham
- 393
- 1
- 3
- 9
3
votes
1 answer
iOS - WKURLSchemeHandler not called on custom scheme
I want to use WKWebView and WKURLSchemeHandler to catch some links with custom schemes. To understand how it works, I've made a simple project (in Objective-C, sorry) with a local html file containing custom schemes
Local…

Bruno
- 3,872
- 4
- 20
- 37
3
votes
0 answers
WKWebView's WKUrlSchemeHandler and Cookies with the Secure property
Since iOS 11, you could use WKURLSchemeHandler with WKWebView:
A protocol for loading resources with URL schemes that WebKit doesn't
know how to handle.
If you used a custom-scheme - let's say foobarhttps - WKWebView does NOT appear to treat it…

rustyMagnet
- 3,479
- 1
- 31
- 41
2
votes
0 answers
How to intercept (see) all requests of a site written in React in WKWebView for iOS 13 and higher?
I can't intercept all requests, I tried to use WKNavigationDelegate, schemeHandler and some repositories, but nothing is working. Is there any way to get them?

Igor Belobrov
- 21
- 1
2
votes
1 answer
How to enable WKURLSchemeHandler to do work off main thread?
I am trying to get WKURLSchemeHandler to serve video files for when a WebView uses a custom url scheme. I realize that didReceive(data) can be called multiple times so I have figured out how to load my video file in chunks and send it back.
The…

Meisam Seyed Aliroteh
- 519
- 3
- 16
2
votes
0 answers
How to replace WKWebView response with internal resource files?
I have a WKWebView that present an HTML file from the project resource files.
Along with the resource files there are CSS and JavaScript files for the web view to use.
Side note:
These web files are for a compiled React web app.
CSS / JS files are…

Bar Malka
- 550
- 1
- 4
- 13
2
votes
2 answers
Swift -- values coming into WKURLSchemeHandler are correct the first time and then never change
I'm a bit of a newbie to Swift programming, and may be using some construct that is making a value immutable after it is set once. I have a WKWebView that is running a JavaScript webapp, and in that JS a URL is being called like this:
var url =…

WagsMax
- 35
- 6
1
vote
0 answers
WKURLSchemeHandler and FormData
I develop hybrid application.
When JS send XMLHTTPRequest with FormData, App WKURLSchemeHandler custom class receives WKURLSchemeTask with request, but request has no HTTPBody or HTTPBodyStream. Both properties has value nil.
Does anyone know,…

Silin Vasya
- 51
- 1
- 6
1
vote
0 answers
WKURLSchemeHandler delegate doesn't get called during evaluateJavascript
I am loading local html file which will load first and then I will have to load an image that is also available locally only after the html is loaded fully. So, I am setting src for the image tag using id and evaluateJavascript. WKURLSchemeHander…

nOOb iOS
- 1,384
- 2
- 19
- 37
1
vote
1 answer
How to serve big files using WKURLSchemeHandler?
I am using WKURLSchemeHandler to serve local files that cannot be read directly by the WkWebView. While it works fine for small files like videos, it totally freezes the application when it has to provide big files like videos.
Right now, I am…

AP.
- 5,205
- 7
- 50
- 94
0
votes
0 answers
Implement WKURLSchemeHandler to intercept http, https error NSInternalInconsistencyException
I refer to How to enable WKURLSchemeHandler to do work off main thread? and try to change to objective-c, but still report an error,
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This task has already been…

Eddy W
- 7
- 2
0
votes
0 answers
How can I solve the 'This task has already been stopped' crash when using WKURLSchemeHandler with WKWebView?
I start to use WKURLSchemeHandler to intercept offline resource, in order to replace NSURLProtocol. However, when I handle the H5 request and it frequently occurred "This task has already been stopped" crash.
enter image description here
here is the…
0
votes
0 answers
WKURLSchemeHandler and fetch requests with custom scheme
I have an application that displays some HTML content with a WKWebView.
I'm using a WKURLSchemeHandler attached to the webview configuration to respond to requests for local resources.
This works as expected for img tags. I'm able to handle the…

Paul Tiarks
- 1,881
- 1
- 13
- 10
0
votes
1 answer
How to fix status code 0 in fetch and XMLHttpRequest for response created by WKURLSchemeHandler
I need to embed html5 games in my app. (Embed into binary, in a such way that i don't need internet connection).
I open index.html with loadHTMLString(htmlContentString, baseURL: "myschemename:///index.html")
I implement WKURLSchemeHandler and face…

Mark
- 701
- 6
- 12
0
votes
1 answer
WKURLSchemeHandler NSInternalInconsistencyException with Task cancellation
I have a problem with WKURLSchemeHandler and Task cancellation and provided an example implementation below.
The problem is, that sometimes right after webView(_:stop:) is called (and "Stopping task ..." is printed) either try…

fxvdh
- 147
- 9