Javascript history does not work
<pre><code>document.addEventListener('DOMContentLoaded', function () {
  displayRecentUrls("recentUrls");
});

function displayRecentUrls(divName) {
    var popup = document.getElementById(divName);
    var ul = document.createElement("ul");
    popup.appendChild(ul);
    var microsecondsPerWeek = 1000 * 60 * 60 * 24 * 7;
    var oneWeekAgo = (new Date).getTime() - microsecondsPerWeek;
    history.search({
      'text': '',              
      'startTime': oneWeekAgo  
    },
    function(historyItems) {
      for (var i = 0; i &lt; historyItems.length; ++i) {
        var url = historyItems[i].url;
        var li = document.createElement("li");
        ul.appendChild(li);
        var a = document.createElement("a");
        a.href = url;
        a.appendChild(document.createTextNode(url));
        li.appendChild(a);
      }

    });
}
</code></pre>

<p>I wrote the code above to generate the browsing history for one week. It does not work. I'm new to Javascript so I may have made a silly mistake.</p>
