admin管理员组文章数量:1315025
The question sounds weird, but here is my case.
I have a UIWebView
in my UIView
( done by [self.view addSubview:webView];
) which occupies full screen. It intentionally hides the UIView
before the UIWebView
clicks on an action javascript:window.close();
.
How do I associate JavaScript in UIWebView
page to UIView
's action , e.g. [webView removeFromSuperView];
?
The question sounds weird, but here is my case.
I have a UIWebView
in my UIView
( done by [self.view addSubview:webView];
) which occupies full screen. It intentionally hides the UIView
before the UIWebView
clicks on an action javascript:window.close();
.
How do I associate JavaScript in UIWebView
page to UIView
's action , e.g. [webView removeFromSuperView];
?
1 Answer
Reset to default 7This is possible:
Set the location to something with your own scheme in the url, i.e.
document.location.href = "myscheme://DoSomething"
This will cause the UIWebViewDelegate method shouldStartLoadWithRequest: to be called with an NSURLRequest parameter whose scheme is"myscheme". So you look for this scheme and extract the DoSomething and then act on the DoSomething, which in your case would be to call remove from superView.
(In the UIWebView dealloc probably need to make sure you call stopLoading)
本文标签: iosClose UIWebView using javascriptwindowclose()Stack Overflow
版权声明:本文标题:ios - Close UIWebView using javascript:window.close(); - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741973119a2407958.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论