ios - wkWebView close window - autoclose -


when click pop in wkwebview, action via

- (nullable wkwebview *)webview:(wkwebview *)webview createwebviewwithconfiguration:(wkwebviewconfiguration *)configuration fornavigationaction:(wknavigationaction *)navigationaction windowfeatures:(wkwindowfeatures *)windowfeatures{ if (!navigationaction.targetframe.ismainframe) {      //[webview loadrequest:navigationaction.request];     [self showinternalweb:navigationaction.request.url.absolutestring];     }      return nil; } 

and displaying link in different controller.

i dismiss controller automatically when window closed. in laptop browser, controller automatically closed after press button on new window. wondering how code functionality myself.

i have tried calling:

[usercontentcontroller addscriptmessagehandler:self name:@"window.close()"]; [self.webview evaluatejavascript:@"window.close()" completionhandler:^(id _nullable obj, nserror * _nullable error) {     nslog(@"suces"); }]; 

this calls webviewdidclose normally, not when window becomes blank.

please check that, did set uidelegate webview..

webview.uidelegate = self; 

Comments