How to override ios webview to own

ios

#1

I am trying override webview of ios to this

https://gist.github.com/marcel-ploch/3a606723c9f230db866fc250da9615e8

for setting cookie to webview

how it can be achieved?
I have tried it on onloadstarted event


#2

To implement cookies in {N} iOS WebView, you shall directly copy the cookie related code from example,

and apply it on loaded event like

    var wkUController  = webView.nativeView.configuration.userContentController;
    var wkCookieScript = WKUserScript.alloc().initWithSourceInjectionTimeForMainFrameOnly(cookieScript, 0, false);
    wkUController.addUserScript(wkCookieScript);

I didn’t try this myself, in case if you face any issues let me know.


#3

Not able to do that
as cookie will be loaded after rendering instead I want to add cookie before that


#4

You mean rendering of webpage, it’s totally on your control - you can decide when you render after or before.