Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webbrowser Control stealing shortcuts

Webbrowser Control in my .NET Windows Form application is stealing shortcuts when on focused. To able to use Alt + F4 I had to click a control first.

Currently "WebbrowserShortcuts = false" but it's still same.

Is there a way to stop this irritating behaviour?

like image 276
dr. evil Avatar asked Nov 14 '22 16:11

dr. evil


1 Answers

I had this problem when loading Silverlight inside a winforms WebBrowser and I solved it by adding the following to the <body> element:

onload="document.getElementById('silverlightControl').focus()"

...which, of course, meant I have to give an id of silverlightControl to my <object> element:

<object id="silverlightControl" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">

If you only have HTML, maybe you can call focus() on the document or perhaps the first hyperlink?

like image 174
Olivier Dagenais Avatar answered Dec 22 '22 21:12

Olivier Dagenais