Jump to content

How to prevent IE to receive focus or pop on top


Juvigy
 Share

Recommended Posts

Hi Guys,

I have a script that manipulates IE page. The problem is that it popups the IE window on top of other windows. How can i prevent that? I tried making the window invisible, but it is affecting me as i don't see the window , but my current window looses focus and for example if i write an email - my outlook looses focus to the IE window and my keyboard input is piped out to IE. How can i prevent that?
 

Quote

This is how to reproduce , i think:

It happened to me several times, in several websites, some of them require log in,

so I will simply give you the HTML code that does it:

 

If you create a file called FocusTest.html, and put this in it:

Quote

 

<body onload="self.focus();">

Then this html page will steal focus every time when loaded.

In orer to test it, you need to open it with IE,

but because you're alraedy focussed on it, then you will not see the problem..

So after opening the file, do this:

Create a small AutoIt script, and put this inside:

Local   $hIntExp    =WinGetHandle("D:\SomeFolder\FocusTest.html - Windows Internet Explorer")
ControlSend($hExp,"","Internet Explorer_Server1","{F5}")

Then, run the script, while the IE window is not focussed,

and see what happens.

IE will take focus from whatever other window that was open.

And that's what I am trying to disable - to disable IE from taking focus from other applications when the focus is on them.

 

Edited by Juvigy
Added reproducer
Link to comment
Share on other sites

After some testing i found that that this only happens when IE has only one tab. IF i have an additional tab - even if a blank one - this never happens. So i have found an easy workaround for this issue, but i am still wandering why this happens if only one tab is open.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...