Bring Internet Explorer to front - Java Script

Posted on 2011-10-11
Last Modified: 2012-08-13

Im using Java Script to open a new browser window using the following code:

win =,"12345","width=400,height=200").focus();

The issue is that I want the browser (Internet Explorer) to get focus, not only the page in the browser.

Is there anyway to bring the actual browser to the front?

Question by:ryankahan
    LVL 82

    Expert Comment

    by:Dave Baldwin
    I doubt that there is since that requires accessing the local machine and javascript is not supposed to be able to do that because it is considered a security risk.
    LVL 75

    Expert Comment

    by:Michel Plungjan
    can you try showModalDialog(url)
    LVL 4

    Expert Comment

    Try it like this:
    win =,"12345","width=400,height=200");

    Or try to look here:

    Or here:

    Accepted Solution


    It seems that what I am trying to do is not possible using java as it has no O/S control so if the browser itself does not have focus then neither will the window.

    I am going to work around this by creating an exe to do what I need and then calling it via scripting (although this will only work with IE).
    LVL 75

    Expert Comment

    by:Michel Plungjan
    Yes you can also create an HTA instead of an exe.

    Author Closing Comment

    Updated, it does not appear to be possible to do what I initially wanted.
    LVL 75

    Expert Comment

    by:Michel Plungjan
    So Dave' comment is correct.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
    Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now