does not work in iOS 7.0.3 The following code works fine in iOS 6.0.1 (using the iOS virtual keyboard, I clicked the ...">

<form target = "_ blank"> does not work in iOS 7.0.3

The following code works fine in iOS 6.0.1 (using the iOS virtual keyboard, I clicked the Go button on the input field)

<html>
    <body>
        <form action="http://stackoverflow.com/" target="_blank">
            <input type="text" />       
        </form>
    </body>
</html>

But when I tried the same code on iOS 7.0.3, this does not work at all. There is no answer after clicking the Go button on the iOS keyboard.

If I remove [target = "_ blank"] from the form tag, it works correctly.

I do not know what is the cause of this problem. Does anyone have the same problem?

+4
source share
3 answers

Pop-ups are blocked by default by iOS by default.

→ Safari → .

+6

, HTML , . - :

- (void)webViewDidFinishLoad:(UIWebView *)aWebView
{
        NSString *script = @"for (i=0; i<document.forms.length; i++) { document.forms[i].target = null; }";
        [aWebView stringByEvaluatingJavaScriptFromString:script];
    }
}
0

jQuery, target="_blank" iOS, submit:

$('#searchform').submit(function(e) {
  if(navigator.userAgent.match(/(iPod|iPhone|iPad)/i)) {
    $(this).removeAttr('target');
  }
});

, , a iOS 8 +.

0

All Articles