title: How to auto-load older Facebook messages in the Chrome Javascript console and deal with "Temporary Failure" error?
body: <p>in a Facebook message conversation, my goal is to get all the messages in one single page, in order to save the complete conversation in one file. 
  I'm not satisfied with downloading the Facebook data because the file provided by Facebook in that case doesn't contain the graphics included in the messages, and worst, the messages for one person are not shown in a strict chronological order.</p>
  
  <p>So I'm using a trick on Google Chrome, using the Javascript console. (Ctrl + Shift + J) and the "mobile" version of Facebook.  <a href="https://m.facebook.com" rel="nofollow">https://m.facebook.com</a>
  Once I'm on a particular message thread, the page displays the last few messages, and a link on top of them allows us to load earlier messages. It is labelled "See Older Messages..." and has an ID named "see_older".</p>
  
  <p>Then on the console, I input this javascript code :</p>
  
  <pre><code>setInterval(function () {
      document.getElementById('see_older')
          .getElementsByClassName('content')[0].click();
  }, 1000);
  </code></pre>
  
  <p>This works fine, the message page gets filled progressively with previous message, but randomly, Facebook returns an error.
  The error says "<strong>Temporary Failure. There was a temporary error, please try again.</strong>"</p>
  
  <p>In the HTML source code : </p>
  
  <pre><code>&lt;div class="_55wr acr apm abb" data-sigil="marea"&gt;
  &lt;span class="mfsm"&gt;Temporary Failure&lt;/span&gt;
  &lt;br /&gt;There was a temporary error, please try again.&lt;/div&gt;
  </code></pre>
  
  <p>The manual solution is simply to click on "Back" on the browser, then wait that the page reloads the previous messages, and launch the javascript command again.
  It can be very tedious.</p>
  
  <p>I was wondering if there was something that could be done in Javascript to detect the occurrence of that error page, make a programmatic Back command on the browser, and when the previous page is ready, execute the script again.
  This way the whole process could be completely unattended until the message thread reaches its beginning.</p>
  
  <p>Thank you very much.</p>