473,322 Members | 1,493 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,322 software developers and data experts.

Do img.src assignment in page OnUnload event handler, Is it dangerous?

Hi everyone,
I want to assign a url to the img.src attribute using javascript so
that browser will send a request according to the url, which is all i
want.

The tricky stuff is i want to do it in Page OnUnload event handler
which is called just before the browser is starting to unload the
document(ESPECIALLY when the user choose to close the browser window
to fire the event).

I use IIS6, IE6,Netscape 7.2, and Mozilla 1.7.3 to do the test.
By checking out IISlog, I find out they all properly logged the
ununload event by assigning to img.src, even when the browser is
directly closed.

So I want to make sure this approach is OK in the three browser i
used.
I think it's risky theoreticly.

Could anyone help me on this? OR tell me where I can get the insider
information.

Thanks a lot.
Roy
Jul 23 '05 #1
4 2481
rf
Roy Wang wrote
The tricky stuff is i want to do it in Page OnUnload event handler


I assume this has something to do with cleaning up a server side process. If
so then it is doomed to failure. What if I merely switch my computer off/it
crashes/there is a power outage/the network fails?. Your onUnload event does
not fire.

What if I have javascript turned off?

Rethink your design so it does not matter what happens to the user, for
example use a session variable and time that out server side.

--
Cheers
Richard.
Jul 23 '05 #2
On 2 Nov 2004 00:17:14 -0800, Roy Wang wrote:

(snip funny post)
..OR tell me where I can get the insider information.


Probably not on a public forum.
...Maybe you should ask Martha Stewart. ;-)

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Jul 23 '05 #3
The purpose is to send some data back to the server using
query string of the request.
But some data won't be collected or accurate unless they are sent whent
the page is exiting.

If javascript is disabled, then no data will be collected.
Thanks,
Roy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #4
rf
Roy Wang wrote:
The purpose is to send some data back to the server using
query string of the request.
But some data won't be collected or accurate unless they are sent whent
the page is exiting.


This is doomed to failure, as I pointed out in the bits of my prior post
that you failed to quote.

--
Cheers
Richard.
Jul 23 '05 #5

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

Similar topics

16
by: Edward Diener | last post by:
Is there a way to override the default processing of the assignment operator for one's own __value types ? I realize I can program my own Assign method, and provide that for end-users of my class,...
5
by: Frank | last post by:
Hi, I have an onunload event in the body tag. When it is activated I want to know if a <a></a> href was clicked and which one. Is there some document property or any other object available for...
9
by: connoisseur.infotech | last post by:
We have a website we need to open popup under following conditions 1) When user close the browser either via X button or alt + f4, file -> Close 2) when he changes URL and goes to some other site....
3
by: JezB | last post by:
I want to clear some specific Session variables when the user closes a page. On my page I have a "return to ..." button which navigates back to the parent page from which it was invoked - under the...
3
by: cmay | last post by:
In reading some documents from the Patterns and Practices group, I had a question about the example given for the Page Controller pattern. (I have posted the code for the BasePage below) In...
1
by: Christian Sengstock | last post by:
Hi all, i have a js application with several event handlers which i manage via prototype .bindAsEventListener. On normal page navigation ( link navigation ) i finish all events handlers...
1
by: killygolaman | last post by:
Hi Guys, Have been looking at this for a while and not sure if there is a solution but hopefully someone can point me in the right direction: The problem is essential I want to undo an update...
6
by: Thiago Macedo | last post by:
I could not find on the web a complete solution for this task. This is not the perfect solution, because it's doesn't have the ability to log the logout if browser crash or user leave it open while...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.