html5 - How do I handle return key on an iOS web view native keyboard? -


in ios app, have uiwebview text fields . i'd respond return key being tapped. how do that?

can somehow access uitextfield can implement uitextfielddelegate method textfieldshouldreturn? or there other way accomplish this?

you need javascript tricks this.

in html document, bind keyup event callback text input control, (last time checked, somehow uiwebview doesn't fire keypress event return key, keyup event best alternative)

in callback, let web view goto custom url scheme. e.g below:

var input = document.getelementbyid('textinput'); input.onkeyup = function(){window.location = 'callback://keyup'}; 

then can handle url scheme in uiwebview's delegate

- (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype {     if ([request.url.scheme isequaltostring:@"callback"]) {         // want          return no;     }      return yes; } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -