I want to use AddEventListener in javascript to reload the page when i press Enter(Like what F5 automatically do), and overall I want to know how to manipulate the shortcuts that being already defined in the computer(Like F5) using JavaScript.
thanks for help
I tried to use Addeventlistener but i couldn’t specify it to reload the page
2
Answers
Try this:
Instead of using "keyup," use the "keydown" event in the addEventListener. Each key has a unique "key code," for example, F5 is associated with the key code 116. Check the condition to determine whether the pressed key has a key code of 116 or not.