I am using UIWebView to load a URL.
Inside the page of that URL, it uses alert(\"whatever msg\") as JavaScript. My UIWebView w
Since a UIWebView translates all Javascript alerts into native UIAlertViews it is fairly simple to block it on the native end. Looking into UIAlertView.h there is only one public method for showing an alert which is conveniently called: - (void)show;.
@interface UIAlertView (Blocker)
@end
#import "UIAlertView+Blocker.h"
@implementation UIAlertView (Blocker)
- (void)show {
return;
}
@end
You can find the answer here: https://stackoverflow.com/a/21698251/2377378