HTML Directives

HTML directives can be used to select or discard parts of a web page, or insert other files into a page.

These directives are only intended to be used by standalone HTML apps. They are not part of any web standard and should not be used in pages loaded from remote web servers. They exist to allow packaged apps to be conditionaly assembled like pages from a remote server.

<!if condition>

<!elif condition>



HTML between <!if> and <!endif> will only be parsed if the given Javascript condition expression is true. Changing the condition after the page has been parsed will have no effect.

Conditional directives can be nested.

Inserts the contents of another file directly into this web page. The browser will wait until the file has loaded before reading the rest of the page.

The filename is given as a Javascript expression, so simple filenames must be enclosed in quotation marks.

If you need more flexibility when assembling pages then you can use EJS templates or PHP server pages in your application.

<!if> <!include "page_fragment.html"> <!else> <p> You are not online <!endif>