By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,759 Members | 1,251 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,759 IT Pros & Developers. It's quick & easy.

How make so child window always has focus unless clossed?

P: n/a
I have a page that opens a child window using window.open(...). How do
I make so that when that child window opens you cannot get the focus
back on the parent window unless you close the child window?

Is it even possible?

Sep 9 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
CyberBless said the following on 9/8/2005 8:34 PM:
I have a page that opens a child window using window.open(...). How do
I make so that when that child window opens you cannot get the focus
back on the parent window unless you close the child window?

Is it even possible?


No.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Sep 9 '05 #2

P: n/a
CyberBless wrote:
I have a page that opens a child window using window.open(...). How do
I make so that when that child window opens you cannot get the focus
back on the parent window unless you close the child window?

Is it even possible?


While such a thing is possible , I don't think that many folks
are going to want to tell you how, as while your intentions may be
honarable, the effect can and probably would be abused
by at least someone reading about it down the road.

Perhaps if you explained what you were upto , a suitable alternative
could be provided that would both address your needs and
avoid the potential frustrations and confusion a user would
experiance in having their browser "hijacked".

Seriously , I'm not trying to give you a hard time , but rather
trying to save both you and others some grief.
--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML/CSS,Javascript,TCP ...
--`
Sep 9 '05 #3

P: n/a

"CyberBless" <gr****@cyberbless.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I have a page that opens a child window using window.open(...). How do
I make so that when that child window opens you cannot get the focus
back on the parent window unless you close the child window?


use a modal dialogue box instead of a child window.
Sep 9 '05 #4

P: n/a
makes perfect sense. Now that you've mentioned it I can see how
something like that could be abused. The parent page is a allowing the
user to choose the products that he or she wants. Once the user is
ready to check out they click a button which runs window.open(). This
child window displays all the products in the users shopping cart and
asks for address, credit card info and so on.

The problem I'm having is If the user navigates back to the parent page
and adds more items to the cart then navigates back to the child page
it does not update. I want to force the user to have to close that
child window in order to get back to the parent page. This will force
the child page containing all the shopping cart info to have to update.
Any other suggestion you may have that alleviates this problem is
welcome. I have no issue with giving you the URL of the actuall
website if you contact me via email. gr****@cyberbless.com.
Thanks
Cyber

Sep 9 '05 #5

P: n/a

"CyberBless" <gr****@cyberbless.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
makes perfect sense. Now that you've mentioned it I can see how
something like that could be abused. The parent page is a allowing the
user to choose the products that he or she wants. Once the user is
ready to check out they click a button which runs window.open(). This
child window displays all the products in the users shopping cart and
asks for address, credit card info and so on.

The problem I'm having is If the user navigates back to the parent page
and adds more items to the cart then navigates back to the child page
it does not update. I want to force the user to have to close that
child window in order to get back to the parent page. This will force
the child page containing all the shopping cart info to have to update.

use a modal dialogue instead of a new window. this will stay in the
forefront and prevent the user from minimising it ect, they only way for
them to get back to the main window will be to close it.
Sep 9 '05 #6

P: n/a
I'm not familiar with modal dialogues. Is it at all possible for you
to give me a hint on how to get started there.

Sep 9 '05 #7

P: n/a
CyberBless wrote:
makes perfect sense. Now that you've mentioned it I can see how
something like that could be abused. The parent page is a allowing the
user to choose the products that he or she wants. Once the user is
ready to check out they click a button which runs window.open(). This
child window displays all the products in the users shopping cart and
asks for address, credit card info and so on.

The problem I'm having is If the user navigates back to the parent page
and adds more items to the cart then navigates back to the child page
it does not update. I want to force the user to have to close that
child window in order to get back to the parent page. This will force
the child page containing all the shopping cart info to have to update.


Basicly the thought is that each time you add an item to the
cart , you update the invoice display at the same time, which
can be sorta entertaining in a strange kind of way.

You can test to see if your window variable is null and if not
you can check if the user has closed the window yourWindowVar.closed
or such to see if indeed you need to bother displaying, but none the
less that would be the basic thought.

Just for fun heres a mockup sample of how I go about a javascript
shopping cart gizmo, but it does not employ a popup window at all.
http://www.drclue.net/projects/jsDHT...ppingCart.html

--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML/CSS,Javascript,TCP ...
--`
Sep 9 '05 #8

P: n/a
Thanks doc. Let me play with this for a while and see how and where I
can fit it into my site.

Sep 9 '05 #9

P: n/a
CyberBless wrote:
I'm not familiar with modal dialogues. Is it at all possible for you
to give me a hint on how to get started there.


Modal dialogs are not consistently supported across various browsers, a
better way is not to use a popup at all. Tabbed browsing allows users to
open their cart in a tab and so should update it whenever they choose.

Geko browsers support 'modal', as does IE 6.

<URL:http://groups.google.com.au/group/comp.lang.javascript/browse_thread/thread/abe7b75f612a4c69/c64dfc9d26893255?q=modal&rnum=2&hl=en#c64dfc9d2689 3255>

--
Rob
Sep 9 '05 #10

P: n/a
CyberBless a écrit :
I have a page that opens a child window using window.open(...). How do
I make so that when that child window opens you cannot get the focus
back on the parent window unless you close the child window?

Is it even possible?


modal in Firefox and Mozilla-based browsers:

"If set to yes, the new window is said to be modal. The user cannot
return to the main window until the modal window is closed. A typical
modal window is created by the alert() function.
The exact behavior of modal windows depends on the platform and on the
Mozilla release version.
The MSIE 6 equivalent to this feature is the showModalDialog() method."

http://developer.mozilla.org/en/docs...ality_features

You have to be careful on how you use this option as it can create
annoyance, frustrations to users.

Gérard
--
remove blah to email me
Sep 10 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.