1.1.0 • Published 9 years ago

includehtml.js v1.1.0

Weekly downloads
1
License
CC-BY-SA-4.0
Repository
github
Last release
9 years ago

includeHTML

includeHTML - Loading HTML parts via HTML tag (pure js)

Supported protocols: http://, https://, file:///

Supported browsers: IE 9+, FF, Chrome (and may be other)

Installation

USAGE:

1.Insert includeHTML into head section in HTML file:

<script src="js/includeHTML.js"></script>

2.Anywhere use includeHTML as HTML tag:

<div><include src="header.html"></include></div>

ALL USAGE (examples):

1.Tag:

  <include scr="menu.html"></include>

2.Async:

    <script>
        includeHTML('header.html', document.getElementById('mainmenu'));
        includeHTML('menu.html', document.getElementById('pagemenu'));
    </script>

3.Sync:

    <script>
      includeHTML([
          ['header.html', document.getElementById('headder')],
          ['menu.html', document.getElementById('menu')],
          ['footer.html', document.getElementById('footer')]
      ], function(){
          //optional callback
      });
    </script>

Development

  • To build script run npm run build