title: Why does localStorage.getItem fail only in IE9?
body: <p>This works perfectly in Chrome and Firefox:</p>
  
  <pre><code>var webStorageSupported = ('localStorage' in window) &amp;&amp; window['localStorage'] !== null;
  if (webStorageSupported &amp;&amp; localStorage.getItem("get_list_center") !== null) {
    document.getElementById('mail_listing').innerHTML = localStorage.getItem("get_list_center");
  }
  </code></pre>
  
  <p>But I get an unknown exception when I view the page in <code>IE9</code>. I am able to get both the element and the content in the local storage if I type: <code>document.getElementById('mail_listing').innerHTML;</code><br>
  and <code>localStorage.getItem("get_list_center");</code> separately in console.</p>
  
  <p><img src="https://i.stack.imgur.com/fbUo4.png" alt="error screen"></p>
  
  <p>When I try to assign the <code>innerHTML</code> as the local storage, unknown exception occurs. What Gives???</p>
  
  <p>Edit: As per suggestion from comment, I've tried to get the local storage in a separate variable then assign that variable inside the innerhtml. It turned out that localstorage was indeed retrieving the HTML formatted code, but it wasn't able to save the whole string:</p>
  
  <pre><code>&lt;table width="100%"&gt;......
     &lt;TD width=\"7%\" align=right&gt;12K &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;\r\n&lt;DIV style=\"DISPLAY: no   
     [[CUT OFF FROM HERE]]
  </code></pre>
  
  <p>I was under the impression that localstorage saves upto 5 MB of text, which is the case for Chrome and Firefox, but maybe this isn't the case for IE9 (Edit: After googling, <a href="https://stackoverflow.com/questions/2989284/what-is-the-max-size-of-localstorage-values">IE9 supports up to 10MB</a> so clearly it's something else). What can I do to solve this problem?</p>
  
  <p>Edit2: I've verified that localStorage is correctly assigning the entire HTML content if it is retrieved right after the content has been set:</p>
  
  <pre><code>localStorage.setItem('get_list_center', document.body.innerHTML);
  var x = localStorage.getItem('get_list_center'); //GETS THE WHOLE HTML CONTENT CORRECTLY.
  </code></pre>
  
  <p>It's just that when I'm getting the content from somewhere else where I need it from, the content gets cut off. localstorage isn't tampered anywhere else.</p>