Sagar Shirke Sagar Shirke - 1 year ago 128
Objective-C Question

Not able to select dropdown in UIWebView for IOS 9

I am display a website's page in UIWebView which is having a dropdown. User is able to select values from dropdown but when application is closed and again opened then this dropdown stops working means user is not able to select it.

Strange thing is that if we display alert box of javascript onclick on that dropdwon then everything works fine after tapping on ok button of alert box (means dropdwon becomes clickable) , so what can be a reason and solution for it?

Answer Source

I had same issue so i have found out work around to deal with it In your website put following javascript lines in document.ready in which dropdown are present

 var appname = 'yourappName';
        var actionName = 'displayAlert';
        var url = appname + '://' + actionName;
        document.location.href = url;

In your controller having UIWebView put following code

  - (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
 navigationType:(UIWebViewNavigationType)navigationType {

    // these need to match the values defined in your JavaScript
    NSString *myAppScheme = @"wfsapp";
    NSString *myActionType = @"displayAlert";

    // ignore legit webview requests so they load normally
    if (![request.URL.scheme isEqualToString:myAppScheme]) {
        return YES;

    // get the action from the path
    NSString *actionType =;

    // look at the actionType and do whatever you want here
    if ([actionType isEqualToString:myActionType]) {
    /*    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Loading"
                                                        message:@"Initialising Search Filters..."

        //[alert show];
    /*   UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@""
        alertController.view.hidden = YES;

        alertController.modalPresentationStyle  = UIModalPresentationCurrentContext;
        alertController.view.backgroundColor  = [UIColor clearColor];*/
        UIViewController *alertController = [UIViewController alloc];
        alertController.view.hidden  = YES;
        alertController.view.backgroundColor = [UIColor clearColor];

        self.view.backgroundColor = [UIColor clearColor];
        self.modalPresentationStyle = UIModalPresentationCurrentContext;

        [self presentViewController:alertController animated:NO completion:^ {

        [alertController dismissViewControllerAnimated:NO completion:nil];


When your page loads and javascript lines are executed Above code doesnt dislpay any viewcontroller but it triggers dropddown to work again

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download