title: JCrumb Breadcrumb for IE8 and below
body: <p>I use <a href="http://www.somethinghitme.com/projects/jCrumb/index.html" rel="nofollow">JCrumb</a> jQuery breadcrumb - It appears that it does not work in IE8 and below. </p>
  
  <p>When I try in EI8 I got this error:</p>
  
  <p>SCRIPT65535: 
  source object not valid
   jquery-1.6.2.min.js, Row 17 Characters 29113</p>
  
  <p>the error of jquery is "this.appendChild(a)"</p>
  
  <p>Does anyone know what i wrong or how to make this compatible with ie8 and below...?</p>
  
  <pre><code>// jCrumb initialization and useage
  $('#breadCrumb').jCrumb({ maxCrumbs: 5 });
  </code></pre>
  
  <p>jquery.jcrumb:</p>
  
  <pre><code>(function ($) {
      $.fn.jCrumb = function (options) {
          var settings = {
              maxCrumbs: 4,
              maxMemory: 15,
              defaultClass: 'jCrumb',
              jqUI: false,
              seperator: "&amp;gt;"
          },
              getCrumbs = function () {
                  var cookieName = "breadcrumbs=",
                      cookies = document.cookie.split(';');
  
                  for (var i = 0; i &lt; cookies.length; i++) {
                      var cookie = cookies[i].replace(/^\s+/, "");
  
                      if (cookie.indexOf(cookieName) == 0) {
                          return cookie.substring(cookieName.length, cookie.length);
                      }
                  }
                  return;
              },
              setCrumb = function (crumb) {
                  var crumbs = getCrumbs();
  
                  if (crumbs) {
                      var maxMemory = settings.maxMemory;
                      crumbCheck = crumbs.split('*');
  
                      if (crumbCheck[crumbCheck.length - 1] != crumb) {
                          crumbCheck.push(crumb);
                      }
  
                      if (crumbCheck.length &gt; maxMemory) {
                          crumbCheck.splice(0, 1);
                      }
  
                      crumbs = crumbCheck.join('*');
                  } else {
                      crumbs = crumb;
                  }
  
                  document.cookie = 'breadcrumbs=' + crumbs + '; path=/';
              },
              removeCrumb = function (crumb, index) {
                  var crumbs = getCrumbs();
                  if (crumbs) {
                      crumbCheck = crumbs.split('*');
                      crumbCheck.splice(index, (crumbCheck.length - index));
                      crumbs = crumbCheck.join('*');
                      document.cookie = 'breadcrumbs=' + crumbs + '; path=/';
                  }
  
                  return;
              };
          return this.each(function () {
  
              if (options) {
                  settings = $.extend(settings, options);
              }
  
              setCrumb(document.title + '^' + window.location.href);
  
              var crumbs = getCrumbs(),
                  crumbVal = "",
                  crumbList = $(document.createElement('ul')).addClass(settings.defaultClass).appendTo($(this)),
                  crumbListItem = "";
  
              if (settings.jqUI) {
                  crumbList.addClass('fg-buttonset fg-buttonset-single ui-helper-clearfix');
              }
  
              if (crumbs) {
                  crumbs = crumbs.split('*');
                  startIndex = 0;
  
                  $(crumbList).html('&lt;li&gt;&lt;a href="index.html" class="home"&gt;Nordjyske Fagfolk&gt;&lt;/a&gt;&lt;/li');
  
                  if (crumbs.length &gt; settings.maxCrumbs) {
                      startIndex = crumbs.length - settings.maxCrumbs;
                  }
  
                  for (var i = startIndex; i &lt; crumbs.length - 1; i++) {
                      crumbVal = crumbs[i].split('^');
                      crumbListItem = $(document.createElement('li'));
  
                      var crumbLink = $(document.createElement('a'));
                      crumbLink.attr({ 'href': crumbVal[1] }).text(crumbVal[0]).appendTo(crumbListItem.appendTo(crumbList));
                      crumbLink.click(function () { removeCrumb($(this).text() + '^' + $(this).attr('href'), $(this).data("index")); });
                      crumbLink.data("index", i);
  
                      if (settings.jqUI) {
                          crumbListItem.addClass('fg-button ui-state-default ui-priority-primary');
                          if (i === 0) {
                              crumbListItem.addClass('ui-corner-left');
                              crumbLink.addClass('ui-icon ui-icon-home');
                          }
                          if (startIndex !== 0 &amp;&amp; i === startIndex) {
                              crumbListItem.addClass('ui-corner-left');
                              crumbLink.addClass('ui-icon ui-icon-carat-1-w');
                          }
                      } else if (settings.seperator) {
                          $(document.createElement('span')).html(settings.seperator).appendTo(crumbListItem);
                      }
                  }
  
                  crumbListItem = $(document.createElement('li'));
                  crumbVal = crumbs[crumbs.length - 1].split('^');
                  $(document.createElement('span')).text(crumbVal[0]).appendTo($(crumbListItem).appendTo($(crumbList)));
  
                  if (settings.jqUI) {
                      crumbListItem.addClass('fg-button ui-state-default ui-priority-primary ui-corner-right ui-state-active');
                  }
  
                  $(".fg-button:not(.ui-state-disabled)").hover(
                      function () {
                          $(this).addClass("ui-state-hover");
                      },
                      function () {
                          $(this).removeClass("ui-state-hover");
                      }
                  )
              }
          });
      };
  })(jQuery);
  </code></pre>