Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 224528 - Firefox not focused when running Web Project
Firefox not focused when running Web Project
Product: ide
Classification: Unclassified
Component: Extbrowser
PC Windows XP
: P2 (vote)
: 7.4
Assigned To: Petr Jiricka
Depends on:
  Show dependency treegraph
Reported: 2013-01-06 02:04 UTC by bht
Modified: 2013-06-18 14:47 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT

IDE log from NB 7.1.2 (47.65 KB, application/octet-stream)
2013-01-21 15:07 UTC, Petr Jiricka
IDE log from dev build (125.75 KB, application/octet-stream)
2013-01-21 15:08 UTC, Petr Jiricka

Note You need to log in before you can comment on or make changes to this bug.
Description bht 2013-01-06 02:04:10 UTC
Browser is FireFox 17.01

For any web project, in the project window, I select the Run action.

According to the IDE output window, the URL is sent to the browser, and I can confirm that the browser gets the URL and displays the page.

However the browser does not request focus so it looks like something is broken.

I think this is a regression since 7.3 or 7.2 - I don't know.

On the other hand, if I select the view action for a HTML file then the browser gets focus. So it seems it is not a browser problem unless the browser makes a distinction between file and http URLs.
Comment 1 bht 2013-01-06 02:07:04 UTC
THe same action is broken if I select "Open in Browser" in the Services Window.
Comment 2 Petr Jiricka 2013-01-07 12:17:19 UTC
Hi, this works fine for me, I can not reproduce. Which OS are you using?

Also, is FireFox your system default browser, or did you set it explicitly in IDE options? Thanks.
Comment 3 bht 2013-01-07 18:30:30 UTC
Operating system is Windows XP. My operating system default browser is FireFox.

I remember having had an issue some weeks ago when my AV software installed Chrome which I uninstalled. Chrome is not cooperative regarding settings on de-installation. I had to fix some registry settings but all looked fine since then. It surprises me that the IDE manages to get the browser to focus file URLs. The IDE opens http URLs as well but just does not focus the browser. Are there any settings anywhere in the system that control focus behavior?
Comment 4 Petr Jiricka 2013-01-10 14:13:37 UTC
Confirmed, I am able to reproduce with Firefox on Windows XP. Works fine for me with other browsers (Chrome, IE), or on other systems (Mac OS X). I haven't tried Win 7/8 yet.
Comment 5 Petr Jiricka 2013-01-11 14:07:13 UTC
Same problem on Windows 8.
Comment 6 Petr Jiricka 2013-01-15 15:35:42 UTC
Actually, on Windows 8, IE has the same behavior - it is not focused. On the other hand, the taskbar icon blinks, so it alerts the user that something is happening. Maybe this is an intended change in Windows?

I debugged this and the code has not changed - the IDE still calls the browser using DDE commands WWW_Activate and WWW_OpenURL.
Comment 7 Petr Hejl 2013-01-18 11:42:33 UTC
I've tested this on Windows 7. Here are the results:

Cold   - Opened & Focused
Hot    - Opened & Focused
Opened - Focused

Cold   - Opened & Focused
Hot    - Opened & Focused
Opened - Focused

Cold means computer started, browser has not been opened yet. Hot means browser has been opened but not running. And opened means browser was running.

So everything seems to be ok on Windows 7 with Firefox ESR 17.02. Considering other comments - might this be an issue on Win XP with Firefox?
Comment 8 bht 2013-01-18 17:49:26 UTC
On my computer (Win XP with FireFox 18.0) all commands open the 1st browser window successfully. Subsequent commands send the URL to the browser (file and http) and a new tab is opened but the browser is not focused. Earlier I had erroneously reported that file protocol would focus a new tab but it doesn't.

But I know that previously a new tab also focused so there appears to be a change in browser behavior. However if I execute the command from my news reader then a new tab focuses the browser.

So I tried NetBeans 7.1.2 where it works as expected.

The difference I can see is in the status bar message. In 7.1.2, I see "Starting browser". In 7.3 I see "Sending URL to browser". So perhaps there is a yet undiscovered difference between NetBeans versions.
Comment 9 Petr Jiricka 2013-01-21 15:06:38 UTC
I found out some more information:

- The behavior in NetBeans 7.1.2 is different when FireFox is set as the system default browser, vs. when Firefox is selected specifically in IDE options. When FireFox is the system default and in the IDE settings I am using the <System Default> option, the browser is fronted as expected.

- The behavior is really different between 7.1.2 and Dev in this case. See the attached log files with -J-Dorg.netbeans.modules.extbrowser.level=100: in NB 7.1.2, we are getting this exception in NbDdeBrowserImpl.displatchURL (around line 370):

1358773852625Exception, gonna start browser: org.netbeans.modules.extbrowser.NbBrowserException: DdeConnect errno >400A< when connecting to server MOZILLA, topic WWW_Activate.

I.e. the IDE tries to open the new tab via DDE and fails (because it connects to MOZILLA instead of FIREFOX), and then it starts the browser using command line, which fronts the browser. In NB 7.2, this exception was fixed by this commit:, which reverts the order of MOZILLA and FIREFOX, so the IDE now connects to FIREFOX via DDE and succeeds, but this does not put the browser to the front.

So ironically, fixing the order of browsers introduced this problem. Petre H, can you please review that my assessment is correct?
Comment 10 Petr Jiricka 2013-01-21 15:07:46 UTC
Created attachment 130453 [details]
IDE log from NB 7.1.2
Comment 11 Petr Jiricka 2013-01-21 15:08:48 UTC
Created attachment 130454 [details]
IDE log from dev build
Comment 12 Petr Jiricka 2013-01-21 17:27:15 UTC
I added a bit more logging for this in:

Interestingly, one reason why this works fine with Chrome is that with Chrome, there is ALSO the exception which tells the IDE to call the browser from the command line: "DdeConnect errno >400A< when connecting to server CHROME, topic WWW_Activate." Which is not surprising given this:

So the question is - should we just kill DDE altogether and just start the browser process? I know this used to be problematic in the past which is why we used DDE in the first place, but probably there is no reason to use DDE in 2013.

Although if we do kill DDE, that would be a risky change, that I would be afraid to do for 7.3. So I suggest to waive this bug for NB 7.3.
Comment 13 Quality Engineering 2013-01-22 03:05:20 UTC
Integrated into 'main-golden', will be available in build *201301220001* on (upload may still be in progress)
User: Petr Jiricka <>
Log: #224528 - adding more logging.
Comment 14 Petr Hejl 2013-01-22 14:25:40 UTC
> So ironically, fixing the order of browsers introduced this problem. Petre H,
> can you please review that my assessment is correct?

Yep seems to be correct. Same on Windows 7 in case I'm not using "system default", but "firefox" option in NetBeans
Comment 15 Petr Jiricka 2013-01-22 16:33:01 UTC
Requesting a waiver for NetBeans 7.3. The fix is too risky for 7.3, and there is a workaround to manually switch to the browser window. Also, the usability impact is mitigated by the fact that on newer versions of Windows, the Firefox taskbar icon flashes. See also the comments above.
Comment 16 Petr Jiricka 2013-01-24 19:13:13 UTC
7.3 waiver approved.
Comment 17 Petr Jiricka 2013-06-17 13:44:47 UTC
Partially fixed in

All browsers except for Internet Explorer now use direct execution of the process, rather than DDE. This fixes the problem for FireFox, but not for Internet Explorer.

The problem with Internet Explorer is that when running IE from command line, then regardless of tab browsing-related settings, IE starts a new window (at least on Win XP and Win 7 where I tested it), rather than opening a new tab in an existing window. While this problem by itself could be avoided - see e.g. solution [1] implemented in C#, the next issue is that with this approach, IE still does not focus, so the original problem remains. And fixing that part is not easy, as witnessed e.g. by blog post [2].

Given this, it does not make sense to abandon the DDE approach for IE, and a new bug 231364 was filed to track the remainder of this issue for IE. Closing as FIXED.

Comment 18 Quality Engineering 2013-06-18 14:47:56 UTC
Integrated into 'main-golden', will be available in build *201306181109* on (upload may still be in progress)
User: Petr Jiricka <>
Log: #224528 (partial fix) - FireFox is now focused when running a web application.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo