473,385 Members | 1,400 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,385 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 22726
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. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.