title: How to detect when DOM and frame are loaded in a Facebook app?
body: <p>I'm writing a Facebook app, and I'm trying to find out how to detect when the iFrame DOM is ready, and when the iFrame has completely loaded. I do not believe that <code>window.fbAsyncInit()</code>  is sufficient, because that fires when the FB API has loaded. I'm specifically looking for the equivalent of <code>jQuery(document).ready()</code> and <code>jQuery(window).load()</code>, but it must work in the Facebook iFrame that my page is located in.</p>
  
  <p>Edit: Most replies seem to reference document ready, but no one has even mentioned window load. I am interested knowing both, not just one or the other. The window load equivalent is actually more important in my case, since I have some large graphics on the page  that must be fully loaded before they can be manipulated.</p>
  
  <p>Edit 2: Upon further investigation, the answer may be to simply wrap <code>jQuery(document).ready()</code> in <code>window.fbAsyncInit()</code>, or use <code>jQuery(window).load()</code>. My initial testing showed these methods were not working as expected. The page I'm working on has some heavy JS, and it turns out that there are a number of async loads on the page that caused my tests to be invalid. <code>jQuery(document).ready()</code> wrapped in <code>window.fbAsyncInit()</code>, and <code>jQuery(window).load()</code> appear to be the correct methods.</p>