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

trying to close a window and open a new one without toolbars

P: n/a
Hi,

client wants for a window with no toolbars to open (technical and
'esthetical' reasons) after the window, user clicks on, is being
closed.

I told them about security settings in browsers and no cross-browsers
solutions and all of that we know, but they have told me they have
seen that before and how then the annoying pop-up windows work? . . .

After reading and searching . . . I still don't see how to get it
right

This is what I have (see below) which is still prompts you with the
message:

"The Web page you are viewing is trying to close the window."

"Do you want to close the window?"

"[YES|NO]"

// Page1_WithBrowswerToolbars.jsp
// - - - - - - - - - - - - - - - - - Page1_With Browswer Toolbars

<html>
<head>
<title>Page1_WithBrowswerToolbars</title>
<script type="text/javascript" language="Javascript">
<!--
function newWindow(popWin){
// __
window.opener = self;
window.close();
// __
popWindow = window.open(popWin, 'popWin',
'width=700,height=600,resize=yes,toolbar=no,locati on=no,scrollbars=yes');
popWindow.focus();
}
-->
</script>
</head>

<body bgcolor="ffffff">
<center><h1>Page1 With Browser Toolbars</h1>
<br />
<br />
<a href="javascript:newWindow('./Page2_WithNoToolbars.jsp')">click
here to open window with no tool bars</a>
</center>
</body></html>

// Page2_WithNoToolbars.jsp
// - - - - - - - - - - - - - - - - - Page2 With No Toolbars
<html>
<head>
<title>Page2_WithNoToolbars</title>
<script type="text/javascript" language="Javascript">
<!--
function CloseParent(){
var hwnd = window.open('','Page1_WithBrowswerToolbars'); // notice,
no page included, only the title of the window you want to hijack
hwnd.close();
}
-->
</script>

</head>

<body onload="CloseParent()">
<center><h1>Page2_WithNoToolbars</h1></center>
</body></html>

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Jul 20 '05 #1
Share this Question
Share on Google+
19 Replies


P: n/a
On 21 Jul 2004 13:00:58 -0700, Albretch wrote:

Read in c.l.j.programmer
client wants for a window with no toolbars to open
reader wants on-topic posts
<script type="text/javascript" language="Javascript">


Which this is not. What makes you think
Java programmers are qualified or able
to abswer JS questions? Most Java programmers
would not even recognize the mistake in that line.

Would you ask the baker about that problem
you are having with the roof on your house?

<http://groups.google.com/groups?q=group:comp.lang.javascript>

In future, please do not post JS questions to c.l.j.p.,
please do not cross-post to three groups (in case you
were wonderring if you might be that important - no,
you are not).

F'Ups set to c.l.js.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 20 '05 #2

P: n/a
Andrew Thompson <Se********@www.invalid> wrote in message news:<1h*****************************@40tude.net>. ..
Would you ask the baker about that problem
you are having with the roof on your house?
Your parallelism I find more off-topic (and I would say stupid) than
my inquiry.

Proof?

I did a javascript group:comp.lang.java.programmer search and got
14,100 (including mine)

'"public class" group:comp.lang.javascript' gives you 359
'"public class" group:comp.lang.javascript -applet'; 108

'"public class" group:comp.infosystems.www.authoring.html'; 12

There must be a reason why javascript qs are more than 100% likely
posted on a java group than java qs are posted in JS/design ones. I
have constantly seen people asking HTML and Javascript questions to
server side java developers here in this group.

They usually complain about HTML/design people being cranky.
In future, please do not post JS questions to c.l.j.p.,
please do not cross-post to three groups (in case you
were wonderring if you might be that important - no,
you are not).

F'Ups set to c.l.js.


Thank you for letting me know how important I should think I am.

Now, do you want to become my mother too?
Jul 20 '05 #3

P: n/a
Albretch wrote:
I did a javascript group:comp.lang.java.programmer search
Great. But Java != JavaScript.
There must be a reason why javascript qs are more than 100% likely
posted on a java group than java qs are posted in JS/design ones.
There must be a reason why articles x-posted to more than one group
are often not appropriate for any of them.
I have constantly seen people asking HTML and Javascript questions to
server side java developers here in this group.
Java and JS questions are off-topic for ciwah, unless they pertain to
the markup used to include them in an html document.
Now, do you want to become my mother too?


Do you want to get plonked?

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #4

P: n/a
> Your parallelism I find more off-topic (and I would say stupid) than
my inquiry.
Andrew's post was off-topic I guess *but you started it* :-P He was simply
pointing out your mistake, so that you/others wouldn't make the same mistake
in the future. He could said it more succinctly and in a nicer way, but at
least he got his point across ...

Proof?

I did a javascript group:comp.lang.java.programmer search and got
14,100 (including mine)

'"public class" group:comp.lang.javascript' gives you 359
'"public class" group:comp.lang.javascript -applet'; 108

'"public class" group:comp.infosystems.www.authoring.html'; 12
I did a "depression" group:sci.med.cardiology search and got 886 results.
Then I did an "atherosclerosis" group:alt.support.depression.medication
search and got 62 results

I must remember from now on to post all depression related questions to
sci.med.cardiology as well
There must be a reason why javascript qs are more than 100% likely
posted on a java group than java qs are posted in JS/design ones. I
have constantly seen people asking HTML and Javascript questions to
server side java developers here in this group.
I'd take a guess that a large proportion of those would be
- posts like yours
- posts by newbies who don't realise the difference between Java and
Javascript
- posts containing the word Javascript but are not related to Javascript
(e.g. posted JSP code that has js code in it)
Thank you for letting me know how important I should think I am.

Now, do you want to become my mother too?


Waah

Jul 20 '05 #5

P: n/a
Brian <us*****@julietremblay.com.invalid> wrote in message news:<10*************@corp.supernews.com>...
Albretch wrote:
I did a javascript group:comp.lang.java.programmer search
Great. But Java != JavaScript.


Jeez! I new these guys would be able to even challenge Einsteins
equation.

They are so smart!!!
There must be a reason why articles x-posted to more than one group
are often not appropriate for any of them.
I have constantly seen people asking HTML and Javascript questions to
server side java developers here in this group.


Java and JS questions are off-topic for ciwah, unless they pertain to
the markup used to include them in an html document.
Now, do you want to become my mother too?


Do you want to get plonked?


Reinforcing exactly my point.

Brian, you have really broken my heart, I could not sleep well
because of your language.
Jul 20 '05 #6

P: n/a
In article <f8**************************@posting.google.com >,
lb*****@hotmail.com enlightened us with...
Hi,

client wants for a window with no toolbars to open (technical and
'esthetical' reasons) after the window, user clicks on, is being
closed.

I told them about security settings in browsers and no cross-browsers
solutions and all of that we know, but they have told me they have
seen that before and how then the annoying pop-up windows work? . . .


They work in IE with no blocking software installed.
My browser, Netscape 7, blocks all that shit. So do many others,
including Firefox, Mozilla, and Opera.
IE on the lowest security setting allows a popup to close the opener,
IIRC.

What the client wants sounds best suited to an intranet application
where the users all have IE and can make the site "trusted". Is this the
case? If not, don't bother. Most internet users do not want popups and
none of them are going to trust your application to close the opener
from a popup. The very concept of such a thing is alien for Opera users,
since new "windows" are able to be opened in one browser instance.
Trying to close the opener might well close the entire application.
Now, if it IS an intranet application and the users have IE, try making
the site trusted in the low security settings. That might make the
message go away.

HTH

--
--
~kaeli~
Once you've seen one shopping center, you've seen a mall.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #7

P: n/a

"Albretch" <lb*****@hotmail.com> wrote in message
news:f8**************************@posting.google.c om...
Hi,

client wants for a window with no toolbars to open (technical and
'esthetical' reasons) after the window, user clicks on, is being
closed.

I told them about security settings in browsers and no cross-browsers
solutions and all of that we know, but they have told me they have
seen that before and how then the annoying pop-up windows work? . . .


If I have my browser open and I'm browsing to one site, and then I go to
another, and then to another, and your client's site happens to be one of
them, then who the hell does your client think he is closing MY browser on
me and opening a different one without my normal configuration? Would your
client like it if he came to my web site and suddenly found that all his
icons had been removed from his desktop because I think a minimalist
appearance is more esthetically pleasing? Tell him how I configure my
software is my business and isn't subject to his esthetical sensibilities.

Jul 20 '05 #8

P: n/a

"Albretch" <lb*****@hotmail.com> wrote in message
news:f8**************************@posting.google.c om...
This is what I have (see below) which is still prompts you with the
message:

"The Web page you are viewing is trying to close the window."

"Do you want to close the window?"

"[YES|NO]"


Unfortunately, that's just what IE does if you try to close the *main*
browser window. You can close any other window without prompting, but you
will always be prompted if you try to close the main window (the very first
window after opening IE). I looked into this quite a while ago, and there
was no solution at the time, and I believe that is still the case.
Jul 20 '05 #9

P: n/a

"Murray" <pa***@SPAMOFFoptusnet.SPAMMAGE.com.au> wrote in message
news:40***********************@news.optusnet.com.a u...

"Albretch" <lb*****@hotmail.com> wrote in message
news:f8**************************@posting.google.c om...
This is what I have (see below) which is still prompts you with the
message:

"The Web page you are viewing is trying to close the window."

"Do you want to close the window?"

"[YES|NO]"
Unfortunately, that's just what IE does if you try to close the *main*
browser window. You can close any other window without prompting, but you
will always be prompted if you try to close the main window (the very

first window after opening IE). I looked into this quite a while ago, and there
was no solution at the time, and I believe that is still the case.


And that's a good thing.

Jul 20 '05 #10

P: n/a

"Harlan Messinger" <h.*********@comcast.net> wrote in message
news:2m************@uni-berlin.de...

"Murray" <pa***@SPAMOFFoptusnet.SPAMMAGE.com.au> wrote in message
news:40***********************@news.optusnet.com.a u...

"Albretch" <lb*****@hotmail.com> wrote in message
news:f8**************************@posting.google.c om...
This is what I have (see below) which is still prompts you with the
message:

"The Web page you are viewing is trying to close the window."

"Do you want to close the window?"

"[YES|NO]"


Unfortunately, that's just what IE does if you try to close the *main*
browser window. You can close any other window without prompting, but you will always be prompted if you try to close the main window (the very

first
window after opening IE). I looked into this quite a while ago, and there was no solution at the time, and I believe that is still the case.


And that's a good thing.


Agreed :-) It would have been nice to disable it for Intranet though, but it
was no big deal
Jul 20 '05 #11

P: n/a
lb*****@hotmail.com (Albretch) wrote in message news:<f8**************************@posting.google. com>...
client wants for a window with no toolbars to open (technical and
'esthetical' reasons) after the window, user clicks on, is being
closed.


And I want a Web page that will detect that the person reading it is
the sort of jerk who wants to create pages that muck with my browser
settings, and proceed to electrocute that user in order to take such
antisocial tendencies out of the gene pool.

But you can't always get what you want...

--
Dan
Jul 20 '05 #12

P: n/a
Murray wrote:
Harlan Messinger wrote:
Murray wrote: <snip>
... . I looked into this quite a while
ago, and there was no solution at the
time, and I believe that is still the case.


And that's a good thing.


Agreed :-) It would have been nice to disable
it for Intranet though, but it was no big deal


There is a bug in current and past IE versions that allows it to be
tricked into closing a window that was not opened with a script, without
showing the dialog. But the technique is unlikely to be reiterated here
(as it is harmful in an Internet context). If you want to know the
unconditional truth you would have to search the comp.lang.javascript
archives for it.

Richard.
Jul 20 '05 #13

P: n/a
Albretch wrote:
Brian <us*****@julietremblay.com.invalid> wrote in message news:<10*************@corp.supernews.com>...
Albretch wrote:
> I did a javascript group:comp.lang.java.programmer search


Great. But Java != JavaScript.


Jeez! I new these guys would be able to even challenge Einsteins
equation.

They are so smart!!!


While you cannot stop crossposting off-topic and replying
using what is left of your brain, would you please FOAD?
PointedEars, Score adjusted, F'up2 where it belongs
Jul 20 '05 #14

P: n/a
On 22 Jul 2004 05:09:59 -0700, Albretch <lb*****@hotmail.com> wrote:

Brian, you have really broken my heart, I could not sleep well
because of your language.

And thanks for playing. *plonk*
Jul 20 '05 #15

P: n/a
> I did a "depression" group:sci.med.cardiology . . .

Same old, same old.

Hard to tell if you should laugh or cry with these HMTL/Javascript
people, . . . they apparently not only challenge Einstein's equation
(see above), but they have also some clues about 'semantic fields' of
words and searching stuff

Jeez, aren't these little smart a$$*$?

Also, I think you have all misread my post in the eaiest possible
way.

I said, I will/need to:

1) open an initial window via target="_new", which would then

2) open a window from 1 which will not have toolbars and

3) would close 1

I wonder how/why would this change the world as we know it.
Jul 20 '05 #16

P: n/a
Albretch wrote:
1) open an initial window via target="_new", which would then

2) open a window from 1 which will not have toolbars and

3) would close 1


Seems unnecessarily complex, even assuming for the sake of argument that
the opening of new windows, and the use of windows without toolbars, are
actually a good idea. Why not just open up the toolbar-less window in
step 1, and avoid the need for the extra interim window that just gets
closed anyway?

--
Dan
Jul 20 '05 #17

P: n/a
lb*****@hotmail.com (Albretch) wrote:
1) open an initial window via target="_new", which would then
Which should be ignored by all browsers. See
http://www.w3.org/TR/html4/types.html#type-frame-target for the
special values of target and note that _new is NOT amongst them.
You're relying on browsers error-correcting this to be the same as
_blank.
2) open a window from 1 which will not have toolbars and
So you must use JavaScript. If you want more details ask in a
JavaScript newsgroup, but I can't imagine it not being a FAQ so check
those first.
3) would close 1
So you need to add something like window.opener.close() to your new
window. Again, if you want more details ask in a JavaScript newsgroup.
I wonder how/why would this change the world as we know it.


It wouldn't change the world at all. Lots of people do this sort of
thing already. It's still a bad idea though.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #18

P: n/a
Albretch wrote:
I said, I will/need to:

1) open an initial window via target="_new", which would then

2) open a window from 1 which will not have toolbars and

3) would close 1

I wonder how/why would this change the world as we know it.


_You_ may have the best intentions in the world, and _you_ may have the
most pressing need in the world to do this. People's lives could be at
stake if you can't do this.

HOWEVER.

If _you_ can do this uninvited then _anyone_ can do it uninvited, and I
don't want Web sites doing this to *MY* Web browser running on *MY*
computer.

It would be like me saying "The gas meter reader needs to get in your
house to read the gas meter. He's just coming to read the meter and he's
perfectly honest, so the easiest thing to do would be to leave the door
on your house unlocked all the time, I don't see how this would change
the world as we know it."

As you can see, leaving the door unlocked for the gas meter reader seems
like a reasonable thing to do until you realize the world is filled with
lots of people who would take advantage of your unlocked door.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 20 '05 #19

P: n/a
DU
Albretch wrote:


I said, I will/need to:

Did you really need to post this to a java programming newsgroup? Has
your post anything to do with java actually?
1) open an initial window via target="_new",

target="_new" is already invalid markup code.
"Except for the reserved names listed below, frame target names must
begin with an alphabetic character (a-zA-Z). User agents should ignore
all other target names."
http://www.w3.org/TR/html401/types.h...e-frame-target
which would then
You can not force this in NS 7.x and Mozilla-based browsers:
user_pref("browser.block.target_new_window", true);

Even HTML 4.01 Technical Recommendation clearly indicate that user
agents can bypass and override target="_blank" calls:

"User agents may provide users with a mechanism to override the target
attribute."
http://www.w3.org/TR/html401/present....html#h-16.3.2
2) open a window from 1 which will not have toolbars and

Automatically opening an unrequested window will be filtered, prevented,
suppressed by a very wide majority of modern browsers nowadays:
NS 7.x, MSIE 6 SP2, Opera 7.x, K-meleon 0.8+, Galeon 1.x, Konqueror 3.x,
Safari 1.x, etc.. not to mention all kinds of 3rd parties add-ons,
browser extensions, etc.

You can not force Opera 7.x, Mozilla-based browsers to suppress
toolbars: that is just impossible to force.

user_pref("dom.disable_window_open_feature.toolbar ", true);
user_pref("dom.disable_window_open_feature.locatio n", true);
user_pref("dom.disable_window_open_feature.persona lbar", true);
user_pref("dom.disable_window_open_feature.menubar ", true);
user_pref("dom.disable_window_open_feature.scrollb ars", true);
user_pref("dom.disable_window_open_feature.resizab le", true);
user_pref("dom.disable_window_open_feature.minimiz able", true);
user_pref("dom.disable_window_open_feature.status" , true);
Since windows XP SP2 release, web developers can not remove by force
statusbar from new secondary windows.
3) would close 1

You can't even force that in Mozilla-based browsers either:
user_pref("dom.allow_scripts_to_close_windows", true);

while there are bugs filed for forcing scripts closing windows with a
cheap js window.opener trick in MSIE 7 and Opera 7: security is now
important you see.

I wonder how/why would this change the world as we know it.


Removing statusbar is removing the toolbar by which users can see http
connections, transfers, loading notifications, security (SSL) padlock
icon status: why would you (or your clients) need to remove such toolbar
from the users' browsers? Did you know that some security hacks were
successful because users could not see the difference (different urls)
between what was written in the statusbar and what was in the
locationbar? So, why would you (or your clients) want to remove both the
statusbar and locationbar on the users' browsers?

Why would leaving these toolbars present change anything for your own
security, your own personal info, your own sensitive info? If you or
your clients can not understand the users' perspective, then just put
and leave your credit card numbers, personal identifications, phone
numbers, etc.. on a webpage for a few days.

DU
--
The site said to use Internet Explorer 5 or better... so I switched to
Mozilla 1.7.3 :)
Jul 23 '05 #20

This discussion thread is closed

Replies have been disabled for this discussion.