window opened by bookmarklet loses focus when bookmarklet finishes




18 years ago
3 years ago


(Reporter: jruderman, Unassigned)


({helpwanted, regression})


Firefox Tracking Flags

(Not tracked)





18 years ago
Steps to reproduce:
1. Type "; void 0" into the location bar and press 

Result: new window opens in back of current window.
Expected: new window opens in front of current window.

This breaks many of my bookmarklets (


18 years ago
Keywords: regression

Comment 1

18 years ago
I can confirm this on MacOS 9, Mozilla 0.9.7.

Another test-case:
1. Drag the "Leo Dict" link to your personal toolbar
2. Make a selection of a word somewhere on the page
3. Click your new toolbar icon
Result: the new window opens behind the old

Note 1: If you mark a word, and then directly click the "Leo Dict" link on the
page, the new window correctly opens in front.
Note 2: The "Leo Dict" javascript line even includes a focus(), but that does
not seem to help.


18 years ago
Blocks: 88810

Comment 2

18 years ago
Please reassign as necessary
Assignee: neeti → jst
Component: Networking → DOM Level 0
QA Contact: benc → desale
Focus problem, over to bryner.
Assignee: jst → bryner

Comment 4

18 years ago
*** Bug 109925 has been marked as a duplicate of this bug. ***

Comment 5

18 years ago
The pseudo-URL listed for this bug works as expected in 2002012206-trunk on
Windows 98, but the following still loses focus immediately when called from the
location bar:

javascript:open('','','width=350,height=180'); void 0

Is anyone else seeing this behavior in other platform/OS combinations?

Comment 6

18 years ago
Mozilla 2002020703, Windows 2000.
the browser appears to do absolutely nothing when I give it
'; void 0'

but 'javascript:open('','','width=350,height=180'); void 0' atleast momentarily
creates a little window which then disappears, focus doesn't change

Comment 7

18 years ago
I'm really sorry. I didn't have my lameness filter on when I wrote the previous
comment. I wasn't seeing the windows being created in the background as I'm so
used to using browser tabs and was expecting them to come up as tabs. I apologise.
[Mozilla 2002020908, Windows 2000); void 0
opens behind current window

javascript:open('','','width=350,height=180'); void 0
opens momentarily in front of current window but quickly shifts to behind


18 years ago
Keywords: nsbeta1

Comment 8

18 years ago
ADT triage team needs info: Is this happening on any top sites?
Whiteboard: [need info]

Comment 9

18 years ago
No, this bug only affects bookmarklets.  In fact, it only affects bookmarklets
that open new windows, and doesn't affect the more common "google search" and
"dictionary lookup" bookmarklets.
Whiteboard: [need info]

Comment 10

18 years ago
When I was in the habit of testing Windows builds, I never saw the problem on
any top sites. Of course, it's hard to tell, since many sites seem to want this
behavior now (e.g., pop-under ads), and I have turned off the ability to spawn
new windows with the onload event in my prefs. Very rarely do I see any sites
that want to spawn a new window with these small dimensions using JavaScript.

Unfortunately, I am not able to test Windows binaries at the present time, and I
have never seen this issue in GNU/Linux builds.

Is this behavior still exhibited in MacOS 9 builds? The platform and OS should
have been changed to all with comment #1.

Comment 11

18 years ago
I should hope it doesn't affect the common prompt(); bookmarklet. As it is, losing focus is merely the Wrong Thing to do. If /prompts/ popped
behind windows, that would be Bad and Wrong. :)

Comment 12

17 years ago
nsbeta1- per Nav triage team
Keywords: nsbeta1nsbeta1-


17 years ago
Summary: javascript: url steals focus when it finishes running → window opened by bookmarklet loses focus when bookmarklet finishes

Comment 13

17 years ago
*** Bug 154939 has been marked as a duplicate of this bug. ***

Comment 14

17 years ago
Changing Platform and OS to all, based on the most recent dupe.

Also please note, per Peter's question in Comment #8, that I would consider
Blogger (cf bug 154939) to be a top site.
OS: Windows 98 → All
Hardware: PC → All

Comment 15

17 years ago
After considering the latest dupe to this bug, I've reset the nsbeta1- keyword
back to nsbeta1 for reconsideration by the nav triage team. See Comment #14. If
nsbeta1 was rejected for lack of any top sites, I think we've seen that now.

Also adding nsCatFood and helpwanted.

Comment 16

17 years ago
Nav triage team: nsbeta1-
Keywords: nsbeta1nsbeta1-

Comment 17

17 years ago
I had originally thought that this might be caused by the URL bar on the 
original window gaining focus. I tried hiding the "Navigation bar" and testing, 
but got the same results.

Looking carefully at what's happening here, it appears that focus switches back 
to the original window in order to unhighlight the bookmarklet. Here's the 
sequence of events:

Add a javascript bookmarklet to the personal toolbar
Click and hold the bookmarklet
- Nothing has happened yet
Release the mouse click
- The bookmarklet is still highlighted as the new window is opening
- The new window opens and is on top for a flash
- It switches back to the original window and unhighlights the bookmarklet

Is the right way to fix this to have the bookmarklet unhighlight immediately 
and then do the bookmarklet action? Why does the original window gain focus? Is 
there still code there that forces a switch back?

Comment 18

17 years ago
*** Bug 161063 has been marked as a duplicate of this bug. ***

Comment 19

17 years ago
This regression might have been caused by the fix for bug 96592, "remove focus
on url-bar after loading a bookmark".

Comment 20

17 years ago
*** Bug 151316 has been marked as a duplicate of this bug. ***

Comment 21

15 years ago
*** Bug 239838 has been marked as a duplicate of this bug. ***

Comment 22

15 years ago
anyone know a workaround for this? thanks.

Comment 23

15 years ago
I don't have a solution, but I've got a Mac OS X testcase

Firefox 0.9.3 running on Mac OS X 10.2.8 exhibits this behavior. 

the following code acts exactly as described in this bug:
----; void 0

But, the following code works as intended (with the new window keeping focus):
[Code for Furl bookmarklet -]

any ideas on a fix?

The unhighlighting of the bookmark/url idea is a good one, but I'm not sure,
since the above code works without a hitch. 

Comment 24

15 years ago
Bug 232605 has a fix for the Firefox version of this bug.
Assignee: bryner → general
QA Contact: desale → ian
Assignee: general → nobody
QA Contact: ian → general

Comment 25

3 years ago
User Agent 	Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
Build ID 	20160315153207

Considering bug 232605 was fixed and I can't reproduce this issue I will close the bug as WFM. If anyone can reproduce the issue on a current build, fell free to reopen it.
Last Resolved: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.