2
I have an item list on which when clicking on any item, and directed to another page for item details. I would like to click on the button ESC keyboard, back to previous page.
Basically make the browser navigation function by going back to the previous page, as the image below:
How to go back to previous page by clicking Esc?
Actually, it only works if you keep the button pressed.
– viana
@acklay was using the wrong event, Sorry. I edited the answer
– Randrade
@Guilhermenascimento Done, thanks for the tip
– Randrade
@Is Randrade sure it’s onKeyDown? It still comes back when you keep the button down. = P
– viana
@acklay may be conflicting with other events, try
document.onkeyup
.– Guilherme Nascimento
@Guilhermenascimento only worked with onKeyUp even! I had already done with window.addeventlistener("keyup") what would be the difference between addeventlistener and Document.onkeyp?
– viana
@acklay addeventlistener add as a "listener" event and can have multiple events, you can manage them by removing without affecting others, the . onkeyup for example can only be a single event controlled by the attribute or property. Note that in IE6/7/8 (8 with quircksmode) we used attachEvent instead of addeventlistener. One thing that addeventlistener doesn’t have up to ES5 at least and the Actionscript3.0 language does has priority, but this is another story.
– Guilherme Nascimento