4

I'm trying to create a website and it's going to be used on Smart TV browsers...
I would like to facilitate user's navigation only using the channel changer button, so my question is:

Is it possible to make a function to detect Channel Up or Channel Down on my website and switch the page?

For example:
If I click on the Channel Up button on the remote control, it goes to page 2.
And if I click the Channel Down button on the remote control, it returns to page 1.

Thanks!

  • FWIW, [Samsung's documentation](https://www.samsungdforum.com/UxGuide/2014/03_input_method.html) suggests that Apps can intercept Channel Up. No word on how its Browser app handles that though. To be honest, this seems like kind of a strange UI you're making. Why not pick a button less surprising? – Lightness Races in Orbit Jan 01 '17 at 22:08
  • well, the browser doesn't send any keypress, only the "space" key when keyboard is detected, so it won't work, even if i choose other button... Thanks. – Ibrahim Orra Jan 02 '17 at 04:03

1 Answers1

2

First thing to check: Is your TV sending the "key" press? You can use simple JS+HTML

<!DOCTYPE html>
<html>
<body>
<script>
document.addEventListener("keydown", function(event) {
  document.getElementById("x").innerHTML=event.which;
});
</script>
<p id="x">The keycode will appear here...</p>
</body>
</html>

Then write down the keycodes. If they aren't showing up, bad luck. Your TV isn't sending the keypress. If they are, using simple "if" you can navigate with Javascript.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
devondre
  • 493
  • 6
  • 14
  • thank you for the help... it didn't send the keypress – Ibrahim Orra Jan 02 '17 at 03:57
  • We are developing an HTML application which we want to run on smart TV/windows box. How do we handle actions on keypress of remote in html. Will the keycodes be different on different remotes ? – samir Aug 09 '18 at 05:01