Jump to content

How to Disable IE from Taking Focus?


Recommended Posts



I am using Windows XP SP3 with IE8.

Many times, if you open IE, enter some URL, and press "Go", and then move to another window while IE loads the page,

then when IE finishes loading the page, the IE window will take focus from the other window you were on.


This interferes with one script of mine, where I need to switch to another window, and do not want the focus to be stolen,

only when I do it manually.


Does anyone know how to disable this behavior in IE?


So when a webpage finishes loading, it will not take focus from another window, if another window is active..


Thank you

Link to comment
Share on other sites

How about waiting for the page to load, and then continue the script?

Notice what the window is called when the page is done loading. Like "Google - Internet Explorer"

Winwaitactive("Google - Internet Explorer")

continue script

Edited by david1337
Link to comment
Share on other sites

  • 3 weeks later...

Hi JohnOne and sorry for the late reply


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:


<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.

I am 90% sure I have seen a setting for that in IE, but now when I need it I do not see it..


I am using Windows XP SP3..

Edited by Zohar
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

  • Recently Browsing   0 members

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