Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Window.close and Explorer 7 problem!

Reply
Thread Tools

Window.close and Explorer 7 problem!

 
 
Jan Tovgaard
Guest
Posts: n/a
 
      11-20-2006
Hey everyone

We have a critical problem, which I can see that other people also has ran
into.
In Internet Explorer 7 it is no longer possible to do a window.close after
opening a window,
without getting a alert message that ask if u want to close the window.
This did NOT happen in Internet Explorer 6, Mozilla firefox or other
browsers.

Here is the code:

<SCRIPT type="text/javascript">

WindowName="";
var left, top;
left = (window.screen.availWidth - 400)/2;
top = (window.screen.availheight - 250)/2;
settings=
"toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=no,"+
"resizable=no, top="+top+", left="+left+", height=250,width=400";

window.open('login.asp?p=ja&<%=Request.Querystring %>',WindowName,settings);

window.opener=self;
window.close();

</SCRIPT>


I have searched for days about this problem and have found the following.

http://www.codeproject.com/useritems...__new_try_.asp

Can anyone get this example to work in IE 7 final?

Does anyone know another way to solve this problem with a hack...?
In firefox there is a config file called user.js, where u can set
"allow_scripts_to_close_windows". Is there a file like this in IE 7 or
explorer?

We need to remove the toolbar, like above, with the window.open,
without getting this alert message..

if u can help solve this, i would call u the best programmer in the world

sincerly
Jan






 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      11-20-2006
Jan Tovgaard said the following on 11/20/2006 9:45 AM:
> Hey everyone
>
> We have a critical problem, which I can see that other people also has ran
> into.


"critical problem"?

> In Internet Explorer 7 it is no longer possible to do a window.close after
> opening a window,


Sure it is.

> without getting a alert message that ask if u want to close the window.


Yes I can.

> This did NOT happen in Internet Explorer 6, Mozilla firefox or other
> browsers.


I am not sure I believe that claim.

> Here is the code:
>
> <SCRIPT type="text/javascript">
>
> WindowName="";
> var left, top;
> left = (window.screen.availWidth - 400)/2;
> top = (window.screen.availheight - 250)/2;
> settings=
> "toolbar=no,location=no,directories=no,"+
> "status=no,menubar=no,scrollbars=no,"+
> "resizable=no, top="+top+", left="+left+", height=250,width=400";
>
> window.open('login.asp?p=ja&<%=Request.Querystring %>',WindowName,settings);


window.open('','_parent','');
window.close();

> window.opener=self;
> window.close();
>
> </SCRIPT>
>
>
> I have searched for days about this problem and have found the following.
>
> http://www.codeproject.com/useritems...__new_try_.asp


That's a VB solution with a button to click.

> Can anyone get this example to work in IE 7 final?


When IE7 Final comes out maybe. As for now, yes I can.

> Does anyone know another way to solve this problem with a hack...?


Yes.

> In firefox there is a config file called user.js, where u can set
> "allow_scripts_to_close_windows". Is there a file like this in IE 7 or
> explorer?


No.

> We need to remove the toolbar, like above, with the window.open,
> without getting this alert message..


Nah, you don't "need" to, you "want" to. Huge difference.

> if u can help solve this, i would call u the best programmer in the world


Don't call me the best programmer in the world, call me the best JS
hacker in the world that can spell properly.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
 
 
 
spamgrabs
Guest
Posts: n/a
 
      11-20-2006
Jan,

It may help to see the context that the script is in. It looks like
maybe IE thinks you are trying to close the only open window, and as
far as I know, it won't let you do that without a warning (in any
version).

If you have a link to an example I may be able to better determine the
problem.

 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      11-21-2006
spamgrabs said the following on 11/20/2006 4:25 PM:
> Jan,
>
> It may help to see the context that the script is in.


No it won't.

> It looks like maybe IE thinks you are trying to close the only open
> window, and as far as I know, it won't let you do that without a
> warning (in any version).


It makes no difference if it is "the only open window" or tab. It's
irrelevant. And, yes, I can close IE (any IE4+ version) without a prompt.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
Andrew Poulos
Guest
Posts: n/a
 
      11-21-2006
Randy Webb wrote:
> spamgrabs said the following on 11/20/2006 4:25 PM:
>> Jan,
>>
>> It may help to see the context that the script is in.

>
> No it won't.
>
>> It looks like maybe IE thinks you are trying to close the only open
>> window, and as far as I know, it won't let you do that without a
>> warning (in any version).

>
> It makes no difference if it is "the only open window" or tab. It's
> irrelevant. And, yes, I can close IE (any IE4+ version) without a prompt.
>


What's the big deal with a script closing a window it did *not* open?

Is it more the stopping of an annoyance that the prevention of
maliciousness?

I do a fair bit of work for clients who run their pages on a more or
less secure/trusted server and it's getting painful trying to explain
why something that was "safe" only six months ago can't be done today
(on the latest version browsers.)

Andrew Poulos
 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      11-21-2006
Andrew Poulos said the following on 11/20/2006 7:59 PM:
> Randy Webb wrote:
>> spamgrabs said the following on 11/20/2006 4:25 PM:
>>> Jan,
>>>
>>> It may help to see the context that the script is in.

>>
>> No it won't.
>>
>>> It looks like maybe IE thinks you are trying to close the only open
>>> window, and as far as I know, it won't let you do that without a
>>> warning (in any version).

>>
>> It makes no difference if it is "the only open window" or tab. It's
>> irrelevant. And, yes, I can close IE (any IE4+ version) without a prompt.
>>

>
> What's the big deal with a script closing a window it did *not* open?


Two things:

1) It allows a web author to control what toolbars/etc are on the window
instead of it being the users choice.

2) It allows a potentially malicious site to try to imitate a desktop app.

> Is it more the stopping of an annoyance that the prevention of
> maliciousness?


Both.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
Jan Tovgaard
Guest
Posts: n/a
 
      11-21-2006
>
>> We need to remove the toolbar, like above, with the window.open,
>> without getting this alert message..

>
> Nah, you don't "need" to, you "want" to. Huge difference.



well i must So these 2 linies of code u send will not remove the toolbar
and
thats what we need...

so this will unfortunately not solve my problem.


 
Reply With Quote
 
Andrew Poulos
Guest
Posts: n/a
 
      11-21-2006
Randy Webb wrote:

>>
>> What's the big deal with a script closing a window it did *not* open?

>
> Two things:
>
> 1) It allows a web author to control what toolbars/etc are on the window
> instead of it being the users choice.


I don't follow. How does a script that can close a window control
toolbars? In IE you can close a window by pressing Alt+F4, the x button
on the title bar, clicking the icon on the title bar and selecting
close. The web author can't prevent me from closing a window I want
closed (and with a popup blocker there's nothing the web author can do
about it.)

> 2) It allows a potentially malicious site to try to imitate a desktop app.


Again I don't follow. How can a script that closes a window be malicious?

I'm not trying to be stubborn but I can't see how a script that can
close pages, that came from the same domain as it, be bad.

Andrew Poulos


 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      11-21-2006
Jan Tovgaard said the following on 11/21/2006 2:16 AM:
>>> We need to remove the toolbar, like above, with the window.open,
>>> without getting this alert message..

>> Nah, you don't "need" to, you "want" to. Huge difference.

>
>
> well i must So these 2 linies of code u send will not remove the toolbar
> and thats what we need...


I didn't say it would. It closes the active window/tab in IE7 though.
Which *is* what you asked.

> so this will unfortunately not solve my problem.


That's true. The problem is you feel a need to try to remove my toolbars
without my consent.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      11-21-2006
Randy Webb wrote:
> Andrew Poulos said the following on 11/20/2006 7:59 PM:

<snip>
>> What's the big deal with a script closing a window it did

> *not* open?
>
> Two things:
>
> 1) It allows a web author to control what toolbars/etc are on
> the window instead of it being the users choice.
>
> 2) It allows a potentially malicious site to try to imitate
> a desktop app.

<snip>

3) It destroys the user's recent browsing history (their ability to go
back to where they have been using the back button).

That history is data that belongs to the user and no web site should be
allowed to destroy it (much as they should not be allowed to wipe data
stored on the clipboard).

Richard.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Explorer 8: C:\Program Files\Internet Explorer\iexplore.exe vs C:\Program Files (x86)\Internet Explorer\iexplore.exe Nathan Sokalski Windows 64bit 16 02-22-2010 08:31 AM
HIDE: Database Explorer / Solution Explorer / Properties NewTel ASP .Net 2 02-23-2006 09:13 PM
Internet Explorer + Windows Explorer + Browsing Sad Computer Support 1 09-08-2004 05:53 PM
Windows Explorer - Internet explorer JamesBenson Computer Support 19 07-31-2004 12:54 AM
can surf in Windows Explorer not Internet Explorer Billh Computer Support 0 05-02-2004 08:47 PM



Advertisments