Why can't I close or reject a Javascript warning in a UIWebView?

Situation: I am calling Javascript alertusing a method UIWebView stringByEvaluatingJavaScriptFromString:like this ...

[myWebView stringByEvaluatingJavaScriptFromString:@"alert('FOOBAR');"];

Problem: iOS displays a “FOOBAR” warning as expected, but clicking the “Close” button does not cancel the warning.

Why can't I close the Javascript warning? How do I close it?

+4
source share
1 answer

This question gave me the greatest understanding of the problem ...

Dead end with GCD and webView

, , JS stringByEvaluatingJavaScriptFromString:, , iOS, , , "" .

- JS alert setTimeout, - ...

NSString *jsMyAlert = @"setTimeout(function(){alert('FOOBAR');}, 1);";

[myWebView stringByEvaluatingJavaScriptFromString:jsMyAlert];

- , UIWebView a UIAlertView, UIWebView JS alert. .

+8

Source: https://habr.com/ru/post/1541800/


All Articles