[thelist] CF: Is CFMAIL buggy?

Joshua Olson joshua at waetech.com
Tue Jan 28 20:54:15 CST 2003


Thank you to everybody that replied--Ben, Erik, Morgan, Pete (in
alphabetical order).  I greatly appreciate the information.

<tip type="Threaded Use of IFrames for server communication" author="Joshua
Olson">
If you use hidden iframes to post information back to the server you may
have encountered problems with the frame reloading too slow after one action
and another action overwrites the return results of the first if it is
called before the first action finishes.

Here's something you an do to help avoid this situation.

1.  Create a hidden div to hold iframes, id = frames_div in this example.
2.  Generate a new iframe for each set of communication back to the server.
3.  Have the resulting page request that the frame be destroyed.

~~~~~~~~~~~~~~~~~~~~~~

var frame_count = 0;

function createFrame()
{
  i = ++frame_count;
  frame = document.createElement('IFRAME');
  frame.id = 'frame_' + i;
  frame.name = 'frame_' + i;
  document.getElementById('frames_div').appendChild(frame);
  return frame;
}

function deleteFrame(id)
{
  frame = document.getElementById(id);
  document.getElementById('frames_div').removeChild(frame);
}

function doServerCall()
{
  frame = createFrame();
  frame.src = 'myfile.asp?frame_id=' + frame.id;
}

Then, the myfile.asp page should at some point tell the parent to delete the
frame:

<script>
  parent.deleteFrame('<%= Request.QueryString("frame_id") %>);
</script>

</tip>




More information about the thelist mailing list