Setting focus on an HTML input inside WebView (Windows RT) seems not to be working RRS feed

  • Question

  • Hello,

    I have a problem with a WebView control inside my WinRT application.

    The flow is as follows:

    1. Open a Page with WebView (when I say 'Page' I mean Windows.UI.Xaml.Controls.Page).
    2. Run a website inside of WebView (through WebView.Navigate)
    3. Inject a Javascript which basically fetches the input element (throught JQuery) and runs focus() method on it.

    When the input element is focused, the software keyboard should appear and I should be able to type in the content.

    I know that this input element is focused only through JQuery selector (':focused'), but I have to manually click on the input and type in the content.

    So my question is - what should I do, after injecting the javascript mentioned in 3., to type in the content of input element without prior clicking on it?

    Monday, October 14, 2013 12:38 PM

All replies

  • Are you setting the focus to the WebView itself or only within the page on the WebView?


    Monday, October 14, 2013 2:02 PM
  • Hello,

    Thanks for your reply. I'm trying to set focus on the HTML input element inside WebView.

    I've checked both ways:

    1. Setting focus from inside the web page (meaning there is a JavaScript which executes on page load, that sets focus on the HTML input element)
    2. Setting focus by invoking script on WebView (via WebView.InvokeScript)

    Both methods do not work.

    When I open the web page mentioned in 1. in IE10, the focus is set properly.

    Piotr Gąsiorowski

    Monday, October 14, 2013 2:14 PM