dr. evil
dr. evil

Reputation: 27265

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?

Upvotes: 5

Views: 663

Answers (1)

Olivier Dagenais
Olivier Dagenais

Reputation: 1552

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?

Upvotes: 1

Related Questions