Skip to content

includeHTML - Include HTML DOM nodes/parts (loading) via HTML tag into HTML-page for templates and SPA (pure js)

License

Notifications You must be signed in to change notification settings

xmoonlight/includeHTML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

USAGE:

1.Insert includeHTML into head section (or before body close tag) in HTML file:

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

2.Anywhere use includeHTML as HTML tag:

<div data-src="header.html"></div>

ALL USAGE (examples):

1.Tag:

  <div data-src="menu.html"></div>
  <div data-include="menu.html"></div>
  <include src="menu.html"></include> <!-- old tag from v1.0 -->
  <div data-src="js/1.js"></div>
  <div data-src="log"></div>

2.Async:

    <script>
       includeHTML('header.html', document.getElementById('header'));
       includeHTML('menu.html', document.getElementById('mainMenu'));
       includeHTML('green.css');
       includeHTML('js/1.js');
       includeHTML('log.txt','log');
    </script>

3.Sync:

    <script>
      includeHTML('header.html', document.getElementById('header'), function(){
        includeHTML('menu.html', document.getElementById('mainMenu'));
      });
    </script>

About

includeHTML - Include HTML DOM nodes/parts (loading) via HTML tag into HTML-page for templates and SPA (pure js)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published