Click to See Complete Forum and Search --> : Testing request... Close window...


cacalex
07-14-2003, 09:04 AM
Is there's a way to know which system the user have ???
(windows2000, XP...)

A got a script that run perfect in XP, but is not working in 2K,

And another one that is running perfect in 2K, but not in XP...

So id like to make a script that would detect it, and then render the right script...

Thanks.

Khalid Ali
07-14-2003, 10:24 AM
alert(navigator.userAgent) is the most you can get out of JavaScript

cacalex
07-14-2003, 10:39 AM
Thanks...

At least, i know i'll have to look another way...

The script i'm trying to make work is suppose to close a web page without confirmation...

Here's the way working in WIN2K

<object id=closeWin type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close"></object>
called by:
javascript: closeWin.Click();


and this is working with WIN-XP

javascript: window.opener=null;window.close();

Any idea how to make it work with both ???

Khalid Ali
07-14-2003, 11:04 AM
make this little change

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

replace null with top

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

cacalex
07-14-2003, 11:20 AM
First, thanks for your interest Kalid !
It is appreciate :)

Your suggestion works fine on XP, but there is still
the annoying "The page(...), Would you like to close it ???"message on an 2K box...

Actually, the answer i get from the "window.navigator.userAgent" is those:

WIN XP :
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

WIN 2K :
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

If the difference on the NT core is really System related,
then i might be able to detect that difference, an then apply the script of my choice...

You help me there, you know that ???

Thanks again,

Alex

Khalid Ali
07-14-2003, 11:24 AM
if your concernis only to close the parent window without the message then you are not implementing it correctly,try this link....and see how it responds to you,it will close the parent window without any darn message ...

http://68.145.35.86/skills/javascripts/CloseParentWindowFromChild.html

if it works for you on win2k then your implementation has some problem..

cacalex
07-14-2003, 11:34 AM
Everything is fine in my implementation.

I'm trying to close the parent windows, FROM the parent windows...

Here's what i gone with :

<HTML>
<HEAD>

<BODY>




WIN XP :
<BR>
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
<BR>
<BR>
WIN 2K :
<BR>
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

<SCRIPT language=Javascript>
function TTRes(){
var tt=window.navigator.userAgent
var testtt=tt.lastIndexOf(".1)")

alert(testtt);

if (testtt=47)
{
javascript: window.opener=top;window.close();
}
else
{
closeWin.Click();
}
}
</SCRIPT>

<FORM>
<INPUT TYPE="button" VALUE="Fermer" onclick="TTRes()">
<BR><BR>
<object id=closeWin type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close"></object>
<BR><BR>
<INPUT TYPE="button" VALUE="Fermer XP" onclick="window.opener=top;window.close();">
<BR>
<INPUT TYPE="button" VALUE="Fermer 2K" onclick="closeWin.Click();">
</FORM>
</BODY></HTML>

But it still need some work

:)

Khalid Ali
07-14-2003, 01:50 PM
Originally posted by cacalex
Everything is fine in my implementation.
:)

If you tried the link I posted you'd known that the code on that page works andit has been tested on windows and MAC...so I'd say look into your implementation..:D

cacalex
07-14-2003, 02:05 PM
Hi Kalid,

I've take a look at your script...
(I even find some error in it ;) ... )

But let me say that again ;

What i want to do is to close an single page, without any child windows...

In fact, i got a 'stand-alone' page, and i want to be able to close that page from it...
Without any child windows... And without confirmation box...



This work on a single page in 2K
<object id=closeWin type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close"></object>

<INPUT TYPE="button" VALUE="Close 2K" onclick="closeWin.Click();">

And this on XP
<INPUT TYPE="button" VALUE="Close XP" onclick="window.opener=top;window.close();">

Now, maybe i'm dumb, but what were you pointing out, about my implementation ???

Thanks again,

;)

Khalid Ali
07-14-2003, 05:18 PM
Originally posted by cacalex
Hi Kalid,

I've take a look at your script...
(I even find some error in it ;) ... )


Can you please care to elaborate on the errors you are referring to..?

cacalex
07-15-2003, 07:53 AM
Ok
No big deal, but if, by example, you
Opens DevEdge Netscape resource site in parent window, and then press close the parent window, you get an error on row1, car1...
Probably the JS files that is lost... (The url is relative, so it can't work when the page is on devedge... No big deal !!! )
;)

That is all i can think about...
(Some mispells too, but i'm not the one who can blame you !!!)


But what about closing an single windows without error message ??? Something like :

<HTML><HEAD><BODY>
<INPUT TYPE="button" VALUE="Close" onclick="window.opener=top;window.close();">
</BODY></HTML>

Did you know a better way to do this ???

cacalex
07-15-2003, 10:25 AM
Can i ask you to test this script on a couple of browser ???

So far, i test it in IE6 only, but it is designed to detect wheter the browser used is on win2K, or win XP, and use the closing method in for the exploitation sytem...

I just want to know if there is some issues about it...

I have no idea of the result in opera or others...

Can you add comments on what it do for you ???

Thanks !


<HTML>
<HEAD>

<BODY>

<object id=closeWin type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close"></object>

<SCRIPT language=Javascript>
function TTRes()
{
var tt=window.navigator.userAgent;
var ttXP2K=tt.search("5.1")

if (ttXP2K>=46)
{
window.opener=top;window.close();
}
else
{
closeWin.Click();
}
}
</SCRIPT>

<FORM>
<INPUT TYPE="button" VALUE="Close" onclick="TTRes()">
</FORM>
</BODY></HTML>

Khalid Ali
07-15-2003, 10:48 AM
Originally posted by cacalex
Ok
No big deal, but if, by example, you
Opens DevEdge Netscape resource site in parent window, and then press close the parent window, you get an error on row1, car1...
???
You have to be prety dumb to judge me on that while you have no idea that what you are calling an error is a default borwser security behaviour.

Second I am not aware of any spelling mistakes,but even if there were thank god programming does not necessarily require you to be in damn english literature class....you have to learn manners to conduct business my friend.I can not believe you are here for help and you insult those who dare to help a dumb ass like you...and good luck with all the help you will get here,I hope no body helps an ignorant person like you.

cacalex
07-15-2003, 11:00 AM
Sorry if i piss you off.

I have not in mind to insult you, or your coding...

That was kind of being funny, thats all...

Ok, i'm a dumbass...

Hope you can pass over this,

Thanks for the help anyway...
The ass i i'm really appreciate it.

cacalex
07-15-2003, 12:42 PM
Anyone ???

pyro
07-15-2003, 12:57 PM
It only worked in IE6 for me (I tried it in Mozilla 1.2, Netscape 7, Netscape 4.7 and Opera 7). If you want one that works in all the above (except Opera) look at http://www.infinitypages.com/research/selfclose.htm

cacalex
07-15-2003, 01:14 PM
Hey Pyro !!!
Someone is alive near here !!

Thanks for the link, and the testing ! If i knew, i would have ask you before...

It is still giving an confirmation message on my 2K box, but it is equiped with ie5, so i guess it is time to upgrade it !!!
:D

See you !