Embedded pdf object steals focus and will not let it go

Posted by Kristian Hebert on Stack Overflow See other posts from Stack Overflow or by Kristian Hebert
Published on 2010-03-19T09:55:56Z Indexed on 2010/03/21 0:11 UTC
Read the original article Hit count: 780

Filed under:
|
|
|

Hi guys,

I was given the task of adding some usability to one of our applications, ie. make sure that every controll has a shortcut key, and that they can be reached by "tabbing" through the page.

The gui runs in a IE. control on a winform, and consists of asp.net pages, so basically it is just asp.net always running in internet explorer.

My problem is that one of the pages has an embeded pdf in it, like so:

<object tabindex="-1" height="273" width="663" visible="false" 
 type="Application/pdf" data="showpdf.ashx#navpanes=0"></object>

showpdf.ashx is an httphandler, that streams the pdf contents to the response. It does not handle focus in any way.

Now when I run this page, the pdf application steals focus, no matter what I do to set it to another control. And when it takes focus, I cannot take it back with the keyboard. Only a mouseclick on the page will set it to another control.

I have tried to set focus in code behind OnPreRender, or in jevescript, but no luck. It seems that the http handler always runs after all the other code, and it sets focus on the pdf object.

Any thought would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about html

Related posts about ASP.NET