473,737 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

popup focus() behaviour with moz, firefox, ie

Hello,

I'm trying to get a popup to keep focus when it is re-clicked.
The script below is supposed to produce this exact behaviour,
however it doesn't work, at least on firefox 1.0.7 and moz 1.7.12
(linux kubuntu). It does work with konqueror.
It seems to work with firefox on windows but not with IE (not completly
sure though).
<script type="text/javascript">
var WindowObjectRef erence = null; // global variable

function openFFPromotion Popup()
{
if(WindowObject Reference == null || WindowObjectRef erence.closed)
/* if the pointer to the window object in memory does not exist
or if such pointer exists but the window was closed */

{
WindowObjectRef erence =
window.open("ht tp://www.spreadfiref ox.com/",
"PromoteFirefox WindowName",
"resizable=yes, scrollbars=yes, status=yes");
/* then create it. The new window will be created and
will be brought on top of any other window. */
}
else
{
WindowObjectRef erence.focus();
/* else the window reference must exist and the window
is not closed; therefore, we can bring it back on top of any
other
window with the focus() method. There would be no need to
re-create
the window or to reload the referenced resource. */
};
}
</script>

(...)

<p><a href="http://www.spreadfiref ox.com/"
target="Promote FirefoxWindowNa me"
onclick="openFF PromotionPopup( ); return false;"
title="This link will create a new window or will re-use
an already opened one">Promote Firefox adoption</a></p>
The weird thing is... it is copied from
http://developer.mozilla.org/en/docs....open#Examples !

I must mention that i've activated javscript and allowed it to control
focus with firefox and even disabled bpopup blocking, but it didn't
helped :(, neither did the many variante i've found on the web or in
this newsgroup.

I'm really clueless, but i'm just catching up with javascript so i hope
i've missed an obvious point.


So if anyone

Apr 20 '06 #1
11 7343
Al*********@gma il.com wrote:
I'm trying to get a popup to keep focus when it is re-clicked.


Don't.
PointedEars
Apr 21 '06 #2
>Don't.
thx a lot ah

Apr 21 '06 #3
Al*********@gma il.com wrote:
Don't.

thx a lot ah


My first followup probably was not enlightening enough ;-)

The reason why what you are trying to do is a Bad Thing:

<URL:http://www.faqs.org/faqs/x-faq/part7/section-42.html>
(This is about programming for the X Window System, but I'm sure you get the
idea anyway.)

Focusing the window most certainly does not work with your Gecko-based
UAs because there are Preferences with which the user can prevent you
from "stealing" the focus, that are enabled by default. Too many
clueless script-kiddies have attempted this in the past.

Please provide attribution of quoted material next time:

<URL:http://jibbering.com/faq/faq_notes/pots1.html>
<URL:http://www.safalra.com/special/googlegroupsrep ly/>
PointedEars
Apr 21 '06 #4
Thomas 'PointedEars' Lahn a écrit :
Al*********@gma il.com wrote:
Don't.

thx a lot ah


My first followup probably was not enlightening enough ;-)

The reason why what you are trying to do is a Bad Thing:

<URL:http://www.faqs.org/faqs/x-faq/part7/section-42.html>
(This is about programming for the X Window System, but I'm sure you get the
idea anyway.)

Focusing the window most certainly does not work with your Gecko-based
UAs because there are Preferences with which the user can prevent you
from "stealing" the focus, that are enabled by default. Too many
clueless script-kiddies have attempted this in the past.


You certainly didn't read my post, i'm not trying to get a popup
constantly on top as you say, but simply to get it on top again when
you click on the main page link.
Once again the preferences to allow it are set in firefox.

Both of your replies are disrespectfull.

Apr 22 '06 #5
ASM
Al*********@gma il.com a écrit :

You certainly didn't read my post, i'm not trying to get a popup
constantly on top as you say, but simply to get it on top again when
you click on the main page link.
Was your post very understanding ?
"I'm trying to get a popup to keep focus when it is re-clicked."
which is a non sens : if popup is clicked it has/get focus

So what we'll remember except 'keep focus' ?
(bad thing to do)

The script you've given is (allmost) correct and have to run as is
- a new popup on 1st call
- same popup comming to front with next calls
Once again the preferences to allow it are set in firefox.
I never fix preferences to stop all popups, only those comming automaticaly.
How to imagine you did stop all popups.
Both of your replies are disrespectfull.


Not first one
Please try to re-read yourself.

--
Stephane Moriaux et son [moins] vieux Mac
Apr 22 '06 #6
Al*********@gma il.com wrote:
Thomas 'PointedEars' Lahn a écrit :
Al*********@gma il.com wrote:
>> Don't.
> thx a lot ah
My first followup probably was not enlightening enough ;-)

The reason why what you are trying to do is a Bad Thing:

<URL:http://www.faqs.org/faqs/x-faq/part7/section-42.html>
(This is about programming for the X Window System, but I'm sure you get
the idea anyway.)

Focusing the window most certainly does not work with your Gecko-based
UAs because there are Preferences with which the user can prevent you
from "stealing" the focus, that are enabled by default. Too many
clueless script-kiddies have attempted this in the past.


You certainly didn't read my post,


Certainly I could not read your thoughts.
i'm not trying to get a popup constantly on top as you say,
| I'm trying to get a popup to keep focus when it is re-clicked.

You will excuse me if "keep" reads as "constantly " to me.
but simply to get it on top again when you click on the main page link.
OK.
Once again the preferences to allow it are set in firefox.
Sorry, I missed that.
Both of your replies are disrespectfull.


No, it was not. Besides, respect has to be earned, and you got what you
paid for.

Besides:

| The weird thing is... it is copied from
| http://developer.mozilla.org/en/docs....open#Examples

MDC is a Wiki, so anybody can post nonsense there (and partially did in this
case). However, the code you have posted (which is not necessarily the
code you are using) works here (provided _all_ prefs are set accordingly).

There can be several reasons why it would not work with you. Try
to find them out by debugging the code. See also the lower part of
news:15******** ********@Pointe dEars.de
Score adjusted

PointedEars
Apr 22 '06 #7
Al*********@gma il.com wrote:
I'm trying to get a popup to keep focus when it is re-clicked.
As you understand by now, this statement of the problem is
incorrect. Rather, you are trying to have a previously created
popup regain focus when a link or button activating it is
clicked.
The script below is supposed to produce this exact behaviour,
however it doesn't work, at least on firefox 1.0.7 and moz 1.7.12
(linux kubuntu). It does work with konqueror.
It seems to work with firefox on windows but not with IE (not completly
sure though).


Indeed, this is a classic case of protectionism run amok.
IE and FF both let you create a named window which they will bring to
the top, especially provided that it was some user instigated
through some user initiated action, such as clicking.

To be clear, this is not a case of a window/app trying to
raise itself to the top. The main window is already at the top,
so if it wants to have a child window come to the top (which may
be viewed as part of the same (already in focus) application),
which it could do anyway with window.open, what is the problem
in allowing window.focus()?

That is to say, it makes eminent sense that if a window, B,
which was created by window A, comes to the top upon creation,
that the same window B should come to the top upon a user
initiated action leading to windowB.focus() The really silly
way around this is to close windowB and then recreate it, which
only serves to drive up internet traffic.

This problem and two ways of dealing with it on FF are described at
https://bugzilla.mozilla.org/show_bug.cgi?id=318535
If you agree with the assessment, I suggest voting for the bug
to give it more visibility.

Unfortunately, I don't know of a nice workaround (other than the
brute force method in the bug report) for my IE 6 on Win XP Pro.
IE will flash the tab at the bottom of my window, but that's a
poor substitute for bringing it to the top.

Csaba Gabor from Vienna
Apr 23 '06 #8
Al*********@gma il.com wrote :
Thomas 'PointedEars' Lahn a écrit :
Al*********@gma il.com wrote:
Don't.
thx a lot ah

My first followup probably was not enlightening enough ;-)

The reason why what you are trying to do is a Bad Thing:

<URL:http://www.faqs.org/faqs/x-faq/part7/section-42.html>
(This is about programming for the X Window System, but I'm sure you get the
idea anyway.)

Focusing the window most certainly does not work with your Gecko-based
UAs because there are Preferences with which the user can prevent you
from "stealing" the focus, that are enabled by default. Too many
clueless script-kiddies have attempted this in the past.


You certainly didn't read my post, i'm not trying to get a popup
constantly on top as you say, but simply to get it on top again when
you click on the main page link.
Once again the preferences to allow it are set in firefox.


Such preference and control is entirely up to the user if he finds the
setting and understand how good or bad the setting can be for his web
experience. Chances are that a very wide majority of users won't know
what "Raise or lower windows" implies and means, so they will trust the
default Firefox setting and will not allow your script to bring back the
secondary window when clicking the link again.

I am personally against the current default value. I tried to educate
the people on what that setting means.
See
http://www.gtalbot.org/FirefoxSectio...seLowerSetting
But then again, if the content is important to be read, seen, then I do
not recommend that you use a secondary window.

Thomas 'PointedEars' Lahn is abrasive, arrogant, even hostile at times
but he's right about not relying, not hoping too much on a focus() call
to work, at least, all the times. It's all up to the user in the final
instance. And, if your webpage design is sound, accessibility-oriented,
then even users with "Raise or lower windows" unchecked should be able
to access your content without a problem. Chances are that if you follow
the usability guidelines and recommendations given at
http://developer.mozilla.org/en/docs/DOM:window.open
then the user will know there is another secondary window and
tab-capable browser users will not open your document in a secondary
window but most likely into a tab.

Gérard
--
remove blah to email me
Apr 26 '06 #9
Csaba Gabor wrote :
Al*********@gma il.com wrote:
I'm trying to get a popup to keep focus when it is re-clicked.
As you understand by now, this statement of the problem is
incorrect. Rather, you are trying to have a previously created
popup regain focus when a link or button activating it is
clicked.
The script below is supposed to produce this exact behaviour,
however it doesn't work, at least on firefox 1.0.7 and moz 1.7.12
(linux kubuntu). It does work with konqueror.
It seems to work with firefox on windows but not with IE (not completly
sure though).


Indeed, this is a classic case of protectionism run amok.
IE and FF both let you create a named window which they will bring to
the top, especially provided that it was some user instigated
through some user initiated action, such as clicking.


It's not that simple. A secondary window could have been brought up
legitimately; after some time, it could be reloaded with advertisement
content. Or who knows; a second click on a link could load a different
document. There are lots of possibilities, variations which a persistent
scripter could take advantage of.
To be clear, this is not a case of a window/app trying to
raise itself to the top.
A setTimeout can do that though.
Some people create a modal window with
<body onblur="self.fo cus();">
you see.

The main window is already at the top, so if it wants to have a child window come to the top (which may
be viewed as part of the same (already in focus) application),
which it could do anyway with window.open, what is the problem
in allowing window.focus()?

The window is not per se the problem: its content (actual, future,
potential) is. When a browser prevents an unrequested popup, it's not so
much the window that is the problem as it is its content (advertisement,
spamming content, annoyance of being served scam ads or anything which
is not related to the reasons to visit a site in the first place).

If you visit some sites like netscape.com and yahoo.com, they are now
using DHTML layers to convey advertisement. No secondary windows
involved. But the same boring, annoying advertisement pollution.
That is to say, it makes eminent sense that if a window, B,
which was created by window A, comes to the top upon creation,
that the same window B should come to the top upon a user
initiated action leading to windowB.focus() The really silly
way around this is to close windowB and then recreate it,
There are scripts available on the web that do exactly that: as the user
reclicks the link, the script closes windowB and then recreate it entirely.

See the 9th link at
https://bugzilla.mozilla.org/attachm...49&action=view

which only serves to drive up internet traffic.

This problem and two ways of dealing with it on FF are described at
https://bugzilla.mozilla.org/show_bug.cgi?id=318535
If you agree with the assessment, I suggest voting for the bug
to give it more visibility.

The bug hasn't even been confirmed yet!
And the bug is about respecting and maintaining user settings when
upgrading Fx.
Unfortunately, I don't know of a nice workaround (other than the
brute force method in the bug report) for my IE 6 on Win XP Pro.


How about simply not using window.open() if your content is important
for the users to read, otherwise warn accordingly users about a
secondary window and do not rely too much on such window.open() +
window.focus() call.

Gérard
--
remove blah to email me
Apr 26 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2432
by: VR | last post by:
First, greetings to everyone :) I'm doing a university seminar & I've encountered a problem. I have a gallery with thumbnails linked on pictures. What I want is popup to be opened with dimensions of linked picture after clicking on a thumbnail. I found javascript which is compatible with IE, Firefox & Opera but I can't get it to work. All I get is this http://www.justfonts.com/tini/problem.html (thumbnail dissapeared).
2
3932
by: lazar | last post by:
I'm triing to write script that close popup window, when user click outside the popup. Script below is working fine in firefox (v1.0.3), but not in IE. I tried also to print hello but still the same problem firefox OK IE not. I think the problem is in event capture, but I can't fix it. My script:
15
18742
by: | last post by:
So many websites can get around my Googlebar's popup blockers. Even Opera 8 can not stop those popups. I looked into the codes, and I can find nothing showing me how it is done. Can anyone help me find what how it is done? First go to http://www.sitepoint.com/forums/showthread.php?t=184025&page=1&pp=25 Click on Last ? on the page
23
6411
by: Markus | last post by:
Hi, i have this problem: Sometimes, i can't reproduce, if i click on an small image on the website, the popup _AND_ an other Tab in firefox open. Here are the linkcode: <div align="center">
4
3600
by: Csaba Gabor | last post by:
Up until a few weeks ago, javascript code like window.open("http://mydomain.com", "windowName"); would always bring my new or reused window to the top, with focus. Lately, Firefox (Deer park alpha 2) only brings it to the top if the window is new. If it's being reused, the window does not come to the foreground (with IE 6 it does). Is there a new way in Mozilla/Firefox that I can ensure that this
3
6862
by: atn2002 | last post by:
I'm trying to create a control which when the mouse button gets pressed on one div an absolute positioned div pops up in place of the cursor. From there the cursor should interact with the dialog before the mouse button is released. In other words one element will catch onmousedown, display the popup, and the popup element will catch onmouseup. This works fine in IE as the popup automatically accepts following events, but my problem is...
3
9111
by: stevenc417 | last post by:
The popup works fine on Firefox 1.5.0.9, but it doesn't work on IE7. It just re-acts like a regular link on IE7. Any ideas anyone? Thanks, Steven -------------------------------------------------- Simple short code below -------------------------------------------------- <html> <head>
0
8966
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8786
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9204
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6052
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4567
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3278
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.