473,231 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

onunload difference in handling IE and Firefox?

HI,
there must be a difference in handling the window.onunload-Event for the two
webbrowsers.

I have a window, that shows the uptodate-state of the logged in members.
The state (is active / is not active) ist read out of a mysql-database.
I want to update the database when a member leaves, so his state would be
"is not active".
This update is driven through a javascript call for a file.

So now there is a nice situation:
- IE does everything right. It does not kick the member out of the active
list, when updating, but it kicks a member, when the window is closed.

- Firefox kicks a member, when the window is both updated and closed.

Can anyone help me in this subject? I tried to find a solution on the
Internet, but I wasn't successful...

regards,
Peter
Feb 3 '06 #1
5 22722
VK

Peter Reinhardt wrote:
HI,
there must be a difference in handling the window.onunload-Event for the two
webbrowsers.

I have a window, that shows the uptodate-state of the logged in members.
The state (is active / is not active) ist read out of a mysql-database.
I want to update the database when a member leaves, so his state would be
"is not active".
This update is driven through a javascript call for a file.

So now there is a nice situation:
- IE does everything right. It does not kick the member out of the active
list, when updating, but it kicks a member, when the window is closed.

- Firefox kicks a member, when the window is both updated and closed.

Can anyone help me in this subject? I tried to find a solution on the
Internet, but I wasn't successful...
Use "onbeforeunload" instead in both cases. regards,
Peter


Feb 3 '06 #2
> Use "onbeforeunload" instead in both cases.
here's a part of my php-script:
-------------------------------------------------------------------
echo "<script type='text/javascript'>
<!--
window.onunload = zuper;
function zuper(){
location.href='show.php?closeboard=1&closefile=$fi leId';
//-->
</script>";

if($_GET['closeboard']==1){

$fileId = $_GET['closefile'];
$deleteQ = " DELETE FROM codereview_editors "
." WHERE Nachname = \"$nachname\""
." AND Vorname = \"$vorname\""
." AND FileID = ".$fileId;
$db->query($deleteQ);
}
-------------------------------------------------------------------
Where is my mistake?
Feb 3 '06 #3
VK

Peter Reinhardt wrote:
Use "onbeforeunload" instead in both cases. here's a part of my php-script:
-------------------------------------------------------------------
echo "<script type='text/javascript'>
<!--
window.onunload = zuper;
function zuper(){
location.href='show.php?closeboard=1&closefile=$fi leId';
//-->
</script>";

if($_GET['closeboard']==1){

$fileId = $_GET['closefile'];
$deleteQ = " DELETE FROM codereview_editors "
." WHERE Nachname = \"$nachname\""
." AND Vorname = \"$vorname\""
." AND FileID = ".$fileId;
$db->query($deleteQ);


Could you give the actual HTML dump instead? If you don't have a PHP
converter handy on your server then simply open the page of question in
any browser and View > Page Source then Copy'n'Past
}
-------------------------------------------------------------------
Where is my mistake?


Will be much easier to aswer after the above is done, really.

Feb 3 '06 #4
Peter Reinhardt said the following on 2/3/2006 5:02 AM:
HI,
there must be a difference in handling the window.onunload-Event for the two
webbrowsers.
Would those "two webbrowsers" you are referring to be Konqueror and
ICEBrowser? Do not fall into the mistake of thinking there are only two.
I know of at least 150 and there are more.
I have a window, that shows the uptodate-state of the logged in members.
The state (is active / is not active) ist read out of a mysql-database.
I want to update the database when a member leaves, so his state would be
"is not active".
This update is driven through a javascript call for a file.

So now there is a nice situation:
- IE does everything right.
"right" or as you want? There is a difference.
It does not kick the member out of the active list, when updating,
but it kicks a member, when the window is closed.

- Firefox kicks a member, when the window is both updated


What are you calling "updating"? How you update will make a difference.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 3 '06 #5
Peter Reinhardt wrote:
Use "onbeforeunload" instead in both cases.
^^^^^^ here's a part of my php-script:
-------------------------------------------------------------------
echo "<script type='text/javascript'>
<!-- ^^^^ window.onunload = zuper; ^^^^^^^^ function zuper(){
location.href='show.php?closeboard=1&closefile=$fi leId';
//--> ^^^^^ </script>";

if($_GET['closeboard']==1){

$fileId = $_GET['closefile'];
$deleteQ = " DELETE FROM codereview_editors "
." WHERE Nachname = \"$nachname\""
." AND Vorname = \"$vorname\""
." AND FileID = ".$fileId;
$db->query($deleteQ);
}
-------------------------------------------------------------------
Where is my mistake?


See above. Should be

<script type="text/javascript">
window.onbeforeunload = function()
{
location.href="show.php?closeboard=1&closefile=<?p hp echo $fileId; ?>";
}
</script>
<?php
// if this refers to a checkbox, isset($_GET['closeboard']) is better
if ($_GET['closeboard'] == 1)
{
$fileId = $_GET['closefile'];

// HereDoc syntax is supported since PHP4
$deleteQ = <<<SQL
DELETE FROM codereview_editors
WHERE Nachname="$nachname"
AND Vorname="$vorname"
AND FileID="$fileId"
SQL;

$db->query($deleteQ);
}
?>
PointedEars
Feb 3 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: pasdecrap | last post by:
The following code will produce similar results in IE6 and firefox 1.0.4 however the left margin in FF is 4 pixels and in IE it is 5. Can anyone see why this is happening? I can't seem to figure...
4
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
3
by: =B= | last post by:
Hi all, I was wondering if anyone has had any luck with trapping the <BODY> onUnload() event in ASP.NET? The thing is, I'm writing code for an Intranet site. The code makes a call to a...
26
by: Jeremy | last post by:
Hi, say we have the code below on a button: <input type="button" class="btn" value="Continue" onclick="if (myform.p_name.value=='') alert('You must enter a name for the folder'); else {...
1
by: Kourosh | last post by:
I'm using IE6 and I've just created a simple page with this event: <body onunload="alert('sad')"> could someone tell me if this works for you if you have IE 6? I've tested this in firefox and...
5
by: jackchang1 | last post by:
I have an application that will submit the form when the page is closed (through onunload event), and it works fine in IE6. But it doesn't work in FireFox, and no data is sent. It seems to me that...
1
by: cyrix | last post by:
I'm having quite a problem with the height in one of my rows in a table. Please see http://www.djcyrix.be/acu/ in both Firefox and IE and you'll see what I mean. Firefox displays the table correctly,...
3
by: ccyarm | last post by:
Hello, I need to modify the following code to make it work with Firefox. It works perfectly well with IE. It seems to me that with Firefox all the form values are lost when the onUnload fires up. ...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.