2

I have one html page open inside UiWebViewController with cordova. While index.html loading inside the Uiwebviewcontroller can we sniff the requests that is originating from index.html?

for example I have following html that is getting opened in UiWebviewcontroller:

<html>
<head>
   <link rel="stylesheet" type="text/css" href="theme.css">
    <script src="app.js"></script>
</head>
<body>
   <img src="img.jpg"/>
</body>
</html>

Can I sniff and modify the url that is getting requested inside Uiwebviewcontroller ie. img.jpg,theme.css,app.js to something like content/img.jpg, css/theme.css, js/app.js using Objective-C.

zoul
  • 102,279
  • 44
  • 260
  • 354
Nirbhay Kundan
  • 389
  • 2
  • 13

1 Answers1

1

Yes, that’s possible using NSURLProtocol, see this blog post by NSHipster and this related Stack Overflow thread.

Community
  • 1
  • 1
zoul
  • 102,279
  • 44
  • 260
  • 354