JavaScript Techies??


Status
Not open for further replies.

togu

Senior Member
Jul 11, 2002
5,290
0
0
44
@ D08
www.tommygui.com
#1
Yo all, some help needed... :(

Wondering if it's possible to let a window load a pl or php script, then close the browser window, whenever the user click on the X button on the top right corner.

The flow should be something like this,

<script>
function leave() {

some functions to load "byebye.pl"
}
</script>
</head>
<body onUnload="leave()">

or any other ways of doing it?


A million thanks.

:)
 

#2
here's a simple script I use for my co. intranet (originally used for ASP page).

<script>
function leave() {
window.open('byebyeTOGU.php','window_handle','width=50,height=50');
}
</script>
</head>
<body onUnload="leave()">


This should pop up the file byebyeTOGU.php whenever the document window is closed or user navigates to another site.

In the php file, you should do whatever you need to do in PHP script and call the javascript window.close() function when you are done, to close this popup window.

not too sure how you will do that in PHP but this works in ASP. :)
 

wantunn

Senior Member
Apr 10, 2002
569
0
16
Sengkang
Visit site
#3
You probably want something like this .... ?

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function leave ()
{
window.open('index.html');
}
//-->
</SCRIPT>
<BODY OnUnload=leave();>
</BODY>
</HTML>
 

munfai

New Member
Apr 19, 2002
1,354
0
0
39
#4
Originally posted by petaflopz
here's a simple script I use for my co. intranet (originally used for ASP page).

<script>
function leave() {
window.open('byebyeTOGU.php','window_handle','width=50,height=50');
}
</script>
</head>
<body onUnload="leave()">


This should pop up the file byebyeTOGU.php whenever the document window is closed or user navigates to another site.

In the php file, you should do whatever you need to do in PHP script and call the javascript window.close() function when you are done, to close this popup window.

not too sure how you will do that in PHP but this works in ASP. :)
no difference between PHP and ASP as we're talking about pure javascript here ;)
 

Status
Not open for further replies.
Top Bottom