To use frames you would just swap out your body tag with your frameset
tag
<frameset onunload="closeMe();" onbeforeunload="closeMe();">
<frame name="content" src="index.cfm" />
<noframes>
you browser must support frames to use this site
</noframes>
</frameset>
I haven't tested this but I believe it should work... I've done
something like this before, although I used iframes.
> Thanks Isaac. However, if I use frames, where would i put
> the
> javascript to trigger the OnBeforeUnload handler? Also
> where would i
> put the actual OnBeforeUnload handler... would it go into
> one of the
> frames.
> Please tell me more, or give some sample code.
> Thanks,
> Ken
> On Wed, 8 Dec 2004 11:11:11 -0500, S. Isaac Dealey
> <[EMAIL PROTECTED]> wrote:
>>
>>
>> > Hi. I am looking for a way by which i can delete the
>> > records entered
>> > by a user, if he closes the browser. Ideas please...
>>
>> > - Ken
>>
>>
>> <head>
>> <script id="browserclose" language="JavaScript" />
>> <script language="JavaScript">
>> function closeMe() {
>> document.getElementById('browserclose').src =
>> 'closeme.cfm';
>> }
>> </script>
>> </head>
>> <body onunload="closeMe();" onbeforeunload="closeMe();">
>> ...
>> </body>
>>
>> The onBeforeUnload event handler is an Internet Explorer
>> specific
>> event handler, however, it behaves the way the onUnload
>> event handler
>> behaves for all other browsers. IE's onUnload event
>> handler
>> unfortunately will not produce the desired effect
>> (afaik). When the
>> window is closed the closeme.cfm page is called and you
>> can do
>> whatever you need on that page. You should also put
>> anything on that
>> page in a <cfsilent> tag just to be sure it doesn't
>> produce a
>> javascript alert for your user. The down-side is the
>> event will fire
>> if the user navigates to another page as well, so if you
>> need to wait
>> until the user is actually closing the browser, then
>> you'll need to go
>> a step further and either use a frameset or iframes to
>> keep the user
>> on the same page throughout their session, or modify all
>> the links and
>> forms on the page to set a javascript variable to prevent
>> the onunload
>> event from loading the closeme.cfm template when a link
>> is clicked or
>> a form is submitted. Personally I'd use the frameset or
>> iframe
>> approach -- it has a lot fewer moving parts and should be
>> easier to
>> develop and less prone to error.
>>
>> s. isaac dealey 954.927.5117
>>
>> new epoch : isn't it time for a change?
>>
>> add features without fixtures with
>> the onTap open source framework
>> http://www.sys-con.com/story/?storyid=44477&DE=1
>> http://www.sys-con.com/story/?storyid=45569&DE=1
>> http://www.fusiontap.com
>>
>>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
http://www.cfdynamics.com
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186670
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54