I have a couple of .html
files and I want to have the same header for all of them. As of now I can do this on Chrome by using html imports:
I have one page called CommonHead.html
that has some JS and CSS files like:
<!-- CommonHead.html -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
And then I have a bunch of other html pages where I put this on the header:
<head>
<link rel="import" href="CommonHead.html">
</head>
That's working perfectly. However, Firefox doesn't support this so I want a way to do the same thing using JavaScript. I tried .load
, using .ge
t into a variable appending the stuff to the header, etc. Nothing seems to work reliably.
Does anyone know what's the proper way to do this using javascript/jquery?