is there a way to control the iPod Touch’s keyboard orientation using JavaScript?


I was wondering if there is a way to control the orientation of the iPod Touch’s keyboard from JavaScript? When the using is in landscape, the keyboard is always displayed in portrait mode which is causing problems with my static positioning of many elements.

Is it possible to control the keyboard’s orientation in Javascript?



No this is not possible.

There's a general way to perform native SDK calls when prompted by Javascript. You can implement the UIWebViewDelegate, and use the shouldStartWithRequest method to capture Javascript requests.

In your Javascript, make a redirect to a non-existent local URL that indicates what you'd like to do. For example:

window.location = "doKeyboardAction";

Then, in your UIWebViewDelegate:

- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url = request.URL;
NSString *urlString = [url.absoluteString lastPathComponent];

if([urlString isEqualToString:@"doKeyboardAction"]){
    NSLog(@"Javascript says to do something.");
    return NO;

return YES;}

This will capture all redirects within the UIWebView, and in the case that the URL is "doKeyboardAction", the WebView won't follow through with the redirect and at that point you can do whatever you want, such as manipulate the keyboard orientation.

By : Goondaba

This video can help you solving your question :)
By: admin