从UIWebView中检测window.open()

Fab*_*oni 8 iphone objective-c uiwebview

简短的问题:是否有可能window.open()UIWebView使用中检测到UIWebViewDelegate或是否有其他方法可以达到此目的?当window.open()-Event被激活以显示时,我需要url UIAlertView.

Fab*_*oni 16

您需要window.open()使用JavaScript 覆盖:

[webView stringByEvaluatingJavaScriptFromString:@"window.open = function (open) { return function  (url, name, features) { window.location.href = url; return window; }; } (window.open);"];
Run Code Online (Sandbox Code Playgroud)