Close UIWebView with javascript: window.close ();

The question sounds strange, but here is my case.

I have UIWebViewin my UIView(running [self.view addSubview:webView];) that takes up the whole screen. He deliberately hides UIViewbefore he UIWebViewclicks on the action javascript:window.close();.

How to associate JavaScript in a UIWebViewpage with an UIViewaction, for example. [webView removeFromSuperView];?

+5
source share
1 answer

It is possible:

Set a location for something with your own schema in the url i.e.

document.location.href = "myscheme: // DoSomething"

UIWebViewDelegate shouldStartLoadWithRequest: NSURLRequest, "myscheme". , DoSomething, DoSomething, superView.

( UIWebView dealloc, , , stopLoading)

+7

All Articles