Ishan Jain
Ishan Jain

Reputation: 8171

how to trigger previous tab(ctrl+pageup) key code in a browser

I want to focus on my browser's previous tabs, so i want to trigger browser tab by triggering key-code. How to do this thing using key code.(and i don't find any keycode for "ctrl+pageup")

Upvotes: 0

Views: 277

Answers (1)

Cerbrus
Cerbrus

Reputation: 72947

That ain't possible.

You can't trigger OS/Browser functions like keypresses from JavaScript.

If this were possible, imagine the problems it would cause by:

  • sites making you save stuff. (Ctrl+S -> Enter)
  • sites making you close things. (Alt+F4)
  • sites making you open new tabs. (Ctrl+T)
  • etc.

You can only simulate these keypresses within the page's JS.

Upvotes: 2

Related Questions