0

There has been a lot of discussions on Stack Overflow about how to dispatch a keyboard event programmatically with JavaScript. However, they are not simulating 'real' key presses in the sense that they merely fire a predefined event handler.

What I want is to simulate CTRL+F to bring up the browser search box. Is that possible at all?

Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
Chong Lip Phang
  • 7,739
  • 5
  • 56
  • 83
  • Doubt it's possible. It's one thing to override such app specific short cuts (such as for a custom html search feature) but completely another to take control of browser features outside of the window – charlietfl Sep 12 '20 at 23:29
  • @charlietfl yeah...I am beginning to doubt it is possible too. It would have become too handy for hackers. lol – Chong Lip Phang Sep 12 '20 at 23:38
  • Yup...think how annoying it would be to see the built in browser search box keep appearing and disappearing – charlietfl Sep 12 '20 at 23:41

1 Answers1

0

window.find(…) does that.

In general, you're out of luck though trying to orchestrate native browser functionality from within a webpage. Browser extensions can do more.

Bergi
  • 572,313
  • 128
  • 898
  • 1,281