What will the URL loading system do when I call "URLProtocol: didLoadData:" in the user protocol URL?

I am using a custom NSURLProtocol to do something before WebView gets a response, everything goes fine except for this url https://dou.bz/23o8PS .

If I stop using NSURLProtocol, just let the WebView load the request (init from the URL), it works fine. But if the data was loaded from the protocol, WebView does not seem to treat it as an HTML file: enter image description here

what will go wrong?

+5
source share
1 answer

I check the header and find:

 Content-Type: text/plain 

possibly other links:

 Content-Type: text/html 
+1
source

Source: https://habr.com/ru/post/1260771/


All Articles