includehtml.js

1.1.0 • Public • Published

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

Package Sidebar

Install

npm i includehtml.js

Weekly Downloads

1

Version

1.1.0

License

CC-BY-SA-4.0

Last publish

Collaborators

  • lgg