I have a Site with 3 frames, and in one of them I load a php page that I want to use an onunload event to save some stuff to the database. The problem is that the onunload event is never called. I have it in the body tag, and to test it am using <body onunload="alert('test')" and I never see an alert box when I navigate away from that page (by loading a different page into that frame). Any ideas. I've tried it using IE6 and Firefox 0.8 . No worky.
onunload not working in frames
Moderator: General Moderators
- Pyrite
- Forum Regular
- Posts: 769
- Joined: Tue Sep 23, 2003 11:07 pm
- Location: The Republic of Texas
- Contact:
onunload not working in frames
Hey people,
I have a Site with 3 frames, and in one of them I load a php page that I want to use an onunload event to save some stuff to the database. The problem is that the onunload event is never called. I have it in the body tag, and to test it am using <body onunload="alert('test')" and I never see an alert box when I navigate away from that page (by loading a different page into that frame). Any ideas. I've tried it using IE6 and Firefox 0.8 . No worky.
I have a Site with 3 frames, and in one of them I load a php page that I want to use an onunload event to save some stuff to the database. The problem is that the onunload event is never called. I have it in the body tag, and to test it am using <body onunload="alert('test')" and I never see an alert box when I navigate away from that page (by loading a different page into that frame). Any ideas. I've tried it using IE6 and Firefox 0.8 . No worky.
- scorphus
- Forum Regular
- Posts: 589
- Joined: Fri May 09, 2003 11:53 pm
- Location: Belo Horizonte, Brazil
- Contact:
Hi, please post the code so I can try it out and give some feed back.
1. You could check in Mozilla's "JavaScript console" (that old JavaScript debugger) and look for some error.
2. Maybe when you load a new page to the frame it does not get "unloaded".
3. Did you try the page with the <body onUnload="...> stand alone? Does it works as expected?
Hope I can help,
Scorphus.
1. You could check in Mozilla's "JavaScript console" (that old JavaScript debugger) and look for some error.
2. Maybe when you load a new page to the frame it does not get "unloaded".
3. Did you try the page with the <body onUnload="...> stand alone? Does it works as expected?
Hope I can help,
Scorphus.
- Pyrite
- Forum Regular
- Posts: 769
- Joined: Tue Sep 23, 2003 11:07 pm
- Location: The Republic of Texas
- Contact:
Well what code should I post? I pasted exactly the onunload I'm using.
I tried opening the page that normally loads in a frame in a new window, and it doens't work there either. In IE at least opening the page in a new window doens't show any javascript errors. I'll try the console debugger though, thanks for the idea.
Hope you can help too.
-Py
I tried opening the page that normally loads in a frame in a new window, and it doens't work there either. In IE at least opening the page in a new window doens't show any javascript errors. I'll try the console debugger though, thanks for the idea.
Hope you can help too.
-Py
- scorphus
- Forum Regular
- Posts: 589
- Joined: Fri May 09, 2003 11:53 pm
- Location: Belo Horizonte, Brazil
- Contact:
Hi Pyrite,
I got it working take a look at http://scorphus.no-ip.com/lab/html/frame/frameset.html and see if it works for you. You can download all the pages packed here: http://scorphus.no-ip.com/lab/html/fram ... set.tar.gz
Regards,
Scorphus.
I got it working take a look at http://scorphus.no-ip.com/lab/html/frame/frameset.html and see if it works for you. You can download all the pages packed here: http://scorphus.no-ip.com/lab/html/fram ... set.tar.gz
Regards,
Scorphus.
- Pyrite
- Forum Regular
- Posts: 769
- Joined: Tue Sep 23, 2003 11:07 pm
- Location: The Republic of Texas
- Contact:
I found out what is causing the problem, I am doing it right, but the php page I'm trying to use it in has an "htmlarea", and apparently there is a bug about that already.
http://www.interactivetools.com/forum/g ... +Flat+Mode
*UPDATE*
And I fixed it by commenting out their Htmlarea Function on Line 666 of htmlarea.js . Thanks for helping me think through this!
Um forte abraço
http://www.interactivetools.com/forum/g ... +Flat+Mode
*UPDATE*
And I fixed it by commenting out their Htmlarea Function on Line 666 of htmlarea.js . Thanks for helping me think through this!
Um forte abraço