How toload shared html into page without server?

i’m trying to share a navbar across multiple pages.
normally you’d do this using jquer’s .load() function or some other method requiring a web server but as shown in the example below it is also possible without a webserver. However using this method for some reason the contents of shared.html get wrapped in a body which alters the layout. Is there another way to load html pages without a server.

<script>
    function load(){
        document.getElementById("navbar").innerHTML='<object type="text/html" data="shared.html" ></object>';
    }
    load();
</script>

<nav class="navbar navbar-default navbar-fixed-top">
   <div class="container">
      ...
   </div>
</nav>


Source: html

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.