by Support_STA » Thu Dec 05, 2013 4:32 am
For this LG on-screen keyboard to work you just need two JavaScript files:
<script type="text/javascript" src="smarttv_getplatform.js"></script>
<script type="text/javascript" src="keyboard.js"></script>
Note that the order of the scripts is important and smarttv_getplatform must be loaded first. You can omit the LGVKeyboard.css stylesheet. Keyboard.js will take case of loading all necessary JS and CSS files when running on the LG platform. Please change the file locations in keyboard.js if necessary. Once you have this every text <input> on your page will activete the on-screen keyboard when focused.
To get your own key event handler working alongside the keyboard you should comment or remove the following lines in keyboard.js:
else
{
// you can use your own event handler - keyboard is built-in -> rename 'onkeydownhandler' to your keydown event handler
document.addEventListener("onkeydown", onkeydownhandler, true);
}
Assuming you already define your own keydown event handler in the onload of your page you should now be able to catch the VK_BACK key code when you press the back key.
Extra note: TV browsers do not necessarily support 'alert()' in javascript, please do not use it.
Best regards,
STA QA