0

Whenever trying to open in chrome I'm getting error as HTTPS error, Chrome is blocking the security.

function w3IncludeHTML() {   var z, i, a, file, xhttp;   z =
  document.getElementsByTagName("*");   for (i = 0; i < z.length; i++)
  {
    if (z[i].getAttribute("w3-include-html")) {
      a = z[i].cloneNode(false);
      file = z[i].getAttribute("w3-include-html");
      var xhttp = new XMLHttpRequest();
      xhttp.onreadystatechange = function() {
        if (xhttp.readyState == 4 && xhttp.status == 200) {
          a.removeAttribute("w3-include-html");
          a.innerHTML = xhttp.responseText;
          z[i].parentNode.replaceChild(a, z[i]);
          w3IncludeHTML();
        }
      }      
      xhttp.open("GET", file, true);
      xhttp.send();
      return;
    }   
  } 
}
c-smile
  • 26,734
  • 7
  • 59
  • 86

1 Answers1

0

I know its a third party library but how about this library:

https://github.com/darshanmarathe/partialjs

It is essentially a remake of ng-include from Angular but stand alone and only about 2kb minified. Allows you to do exactly what you are asking like so:

  <partial src="templates/header.html"></partial>`
sethreidnz
  • 665
  • 6
  • 19