HomeIntegrationsHTML Website Chatbot
Static HTML & Vanilla JavaScript

AI Chatbot HTML: Add a Chatbot to Any HTML Website

Learn how to add an AI chatbot to your website HTML with one standalone, under 20 KB vanilla JavaScript snippet. No npm packages, no bundler, and no backend required — train your agent on your XML sitemap, PDFs, and Excel sheets with knowledge-grounded accuracy.

Zero dependencies (no jQuery or React)Async non-blocking loaderFloating, inline, and fullscreen modes

Copy-Paste Installation for Static HTML

Choose a corner chat bubble for your whole site, mount the widget inline inside a support page, or dedicate a full browser window to your AI assistant.

OPTION 01

Floating Widget (Before </body>)

Default bottom corner bubble

Paste this snippet right before the closing </body> tag in your index.html. The async attribute ensures the script downloads in parallel without delaying page render.

index.html (before </body>)HTML / JS
<!-- Knogents AI Agent -->
<script>
  window.widgetConfig = {
    chatbotId: "YOUR_CHATBOT_ID"
  };
</script>
<script
  async
  data-id="YOUR_CHATBOT_ID"
  id="knogents-widget-script"
  type="text/javascript"
  src="https://knogents.com/embed.js"
></script>
OPTION 02

Inline Embed Inside a Page Section

Ideal for support.html or contact.html

Add a container with id="rag-inline-bot" inside your HTML layout and set display: "inline". Make sure the container exists in the DOM above the script tag.

support.htmlHTML / JS
<!-- Target Container -->
<div id="rag-inline-bot" style="width: 100%; height: 600px; min-height: 450px;"></div>

<!-- Knogents Inline Embed -->
<script>
  window.widgetConfig = {
    chatbotId: "YOUR_CHATBOT_ID",
    display: "inline"
  };
</script>
<script
  async
  data-id="YOUR_CHATBOT_ID"
  id="knogents-widget-script"
  type="text/javascript"
  src="https://knogents.com/embed.js"
></script>
OPTION 03 / FULLSCREEN PORTAL

Need a dedicated help page?

Set display: "fullscreen" in window.widgetConfig to expand the chat interface across the entire viewport on a standalone HTML page.

display: "fullscreen"

Built for Fast Static Websites

Keep your static site fast while offloading document parsing, vector search in PostgreSQL pgvector, and lead capture to Knogents.

Under 20 KB Vanilla JavaScript

No framework runtime, no npm install, and no build pipeline changes. Works cleanly alongside custom CSS and supports custom themes or full CSS styling on the Standard plan.

Excel, CSV, PDF & Docs Retrieval

Upload multi-sheet .xlsx, .xls, and .csv files plus .pdf, .docx, .md, and .txt files. Our table chunking engine keeps column headers intact across chunks so pricing and spec tables stay accurate.

Automated Sitemap Sync & Grounding

Point Knogents at your sitemap.xml or individual HTML URLs. Connected pages re-index automatically (monthly on Free, weekly on Basic, daily on Standard), and every response cites its source document or URL.

Meeting Capture & Email Lead Alerts

Detect natural language appointment requests, check for scheduling conflicts, and capture visitor contact details right inside the widget. Instant email alerts deliver the lead and notes straight to your inbox.

Production Checklist: Adding an AI Chatbot to Website HTML

Static HTML websites hosted on GitHub Pages, Netlify, Cloudflare Pages, Vercel Static, or AWS S3 prioritize fast load times, strict browser security policies, and minimal scripts. Here is how to deploy an HTML chatbot cleanly across multi-page templates, static site generators, and hardened headers without degrading Lighthouse scores.

1. Multi-Page HTML Templates & Static Site Generators

Instead of manually editing dozens of individual .html pages, place the window.widgetConfig block and embed.js loader once inside your shared footer partial. Static site generators and classic server templates propagate the widget site-wide on the next build:

  • Plain Multi-Page HTML / cPanel: Place the snippet inside a shared footer include or copy it before </body> on landing pages, pricing pages, and documentation hubs.
  • Jekyll, Hugo & Eleventy (11ty): Drop the script into _includes/footer.html or layouts/partials/footer.html so every generated HTML route loads asynchronously.
  • Astro & Vite Multi-Page Builds: Add the snippet to your base layout shell with is:inline where needed so build tools do not bundle or rewrite the external https://knogents.com/embed.js URL.
  • Dedicated Help Pages: Keep the default floating bubble across marketing pages while embedding display: "inline" inside /support.html or /faq.html with <div id="rag-inline-bot"></div>.

2. Content Security Policy (CSP), Origin Isolation & Privacy

Security-conscious static websites often enforce strict HTTP response headers via Netlify _headers, Cloudflare Transform Rules, or Nginx configs. Because embed.js runs entirely client-side without external runtime libraries, keeping CSP tight takes only two directives:

# Minimum CSP directives for Knogents embed.js
Content-Security-Policy:
  script-src 'self' https://knogents.com;
  connect-src 'self' https://knogents.com;
  • Cookie-Free Session State: Conversation history uses ephemeral browser sessionStorage rather than third-party advertising cookies, simplifying consent banners on static marketing pages.
  • Zero DOM Pollution Before Click: When loaded with async, the script waits for the browser parser to finish HTML layout, protecting First Contentful Paint (FCP), Cumulative Layout Shift (CLS), and Interaction to Next Paint (INP).

3. Five-Step Pre-Launch Verification for Static Sites

  1. STEP 01Connect Sitemap & FilesImport your sitemap.xml, PDFs, or .xlsx sheets and inspect indexed chunks in your Knogents workspace.
  2. STEP 02Verify Agent IDConfirm both window.widgetConfig.chatbotId and data-id carry your exact dashboard agent ID.
  3. STEP 03Check DOM OrderFor inline widgets, place <div id="rag-inline-bot"></div> above the script tag so it exists at mount time.
  4. STEP 04Authorize OriginTest from your production HTTPS domain (not file:// locally) and check DevTools Network tab for 200 responses.
  5. STEP 05Audit Edge QuestionsAsk pricing, refund, and unsupported off-topic questions to verify grounded refusal and lead capture alerts.

HTML Chatbot vs. Static FAQ Accordions & Generic Widgets

A common question for teams running static HTML documentation sites is whether an embedded AI chatbot actually outperforms plain <details> FAQ accordions or client-side search scripts like Lunr.js. Keyword search requires visitors to guess your exact page vocabulary, whereas Knogents translates every uploaded guide, product CSV, and HTML route into high-dimensional vector embeddings inside PostgreSQL pgvector.

Comparison of HTML Website Chatbot vs Static FAQ Search
CapabilityKnogents HTML AI ChatbotStatic FAQ / Client Search
Query MatchingSemantic intent retrieval across synonyms and multi-part questionsLiteral keyword matches only
Browser Bundle WeightUnder 20 KB async loader; index lives server-side in pgvectorJSON search indexes bloat browser downloads as docs grow
PDFs & SpreadsheetsReads uploaded PDFs, DOCX, and multi-tab Excel/CSV price sheetsHTML page text only; attachments stay invisible
Lead & Booking CaptureCaptures contact details and requests meetings with instant email alertsRequires separate contact forms and manual navigation

Compatible Static Hosts

Plain HTML / cPanelGitHub PagesNetlifyCloudflare PagesVercel StaticAWS S3 + CloudFront

Transparent Monthly Plans

Start free on your static site and scale with flat monthly tiers or modular add-ons.

Free ($0/mo)

100 messages/mo, 1 agent, 30K chars, monthly sync, 0 extra seats (Owner only)

Start free
Basic ($29/mo)

1,000 messages/mo, 2 agents, 150K chars, weekly sync, 2 extra seats, 5 themes

Details
Standard ($59/mo)

3,000 messages/mo, 6 agents, 500K chars, daily sync, 3 extra seats, custom CSS

Details

Add-ons available anytime: +1,500 messages ($10/mo), +1 agent ($8/mo), Remove Branding ($10/mo).

Scope & Boundaries

Know what Knogents handles out of the box before you embed it.

  • Automated AI only: There is no shared human live-chat inbox. Escalations and captured leads go to your email and Knogents dashboard.
  • Websites only: No social DM or external messaging inbox automation.
  • Prompt and RAG driven: No drag-and-drop visual flowchart builder for rigid decision trees.
  • No ticketing CRM or native HubSpot/Salesforce sync: Review transcripts, usage analytics, and leads inside your Knogents workspace.

Frequently Asked Questions

Common questions about installing Knogents on static HTML websites.

How do I add an AI chatbot to an HTML website?

Open your index.html (or shared HTML footer) in your editor, paste the window.widgetConfig and embed.js snippet right before the closing </body> tag, replace YOUR_CHATBOT_ID with your agent ID from the Knogents dashboard, and deploy your file.

Does embed.js need jQuery, React, or a bundler like Vite or Webpack?

No. Knogents embed.js is standalone vanilla JavaScript under 20 KB with zero external dependencies. It runs directly in the browser on static sites hosted on GitHub Pages, Netlify, Cloudflare Pages, AWS S3, or standard cPanel hosting.

Why does window.widgetConfig need to come before embed.js?

When embed.js initializes, it reads your chatbotId and display mode (floating, inline, or fullscreen) from window.widgetConfig. Defining the config object right above the loader script guarantees those settings are ready before the widget mounts.

How do I embed the HTML chatbot inside a specific section of my page?

Add <div id="rag-inline-bot"></div> where you want the chat interface to appear (such as inside a <main> or <section> block), then set display: "inline" inside window.widgetConfig. The widget mounts directly inside that container.

Will adding an HTML chatbot script hurt Core Web Vitals or page speed?

No. The embed script is under 20 KB, loads with the async attribute, and executes client-side without blocking HTML parsing, CSS layout, or Largest Contentful Paint. All document indexing and PostgreSQL pgvector searches run remotely on Knogents servers.

What Content Security Policy (CSP) rules are needed for an HTML chatbot?

If your static host or Nginx/Cloudflare config enforces strict Content-Security-Policy headers, allow https://knogents.com in script-src and connect-src so the loader downloads cleanly and sends encrypted chat requests over HTTPS.

Can I add the same HTML chatbot to multiple static pages or subdomains?

Yes. Paste the same snippet across every HTML template or static site generator layout partial (Hugo, Jekyll, Eleventy, Astro) on authorized domains. For separate bots with distinct knowledge bases, Basic includes 2 agents ($29/mo) and Standard includes 6 agents ($59/mo).

How does Knogents handle visitor follow-ups if a human is needed?

Knogents is an automated AI agent and does not include a live human chat console. When a visitor wants to talk to your team or book a consultation, the agent collects their name, email, and notes (or checks for scheduling conflicts and books a time slot) and sends an instant email notification to your inbox.

Add Knogents to Your HTML Site Today

Connect your sitemap, upload your PDFs or spreadsheets, and paste the embed snippet before your closing body tag.

Solutions Powered by this Integration

Explore autonomous AI customer service and sales workflows built for your platform.

Setup Guides & Tutorials

Step-by-step technical guides for setting up Knogents on this platform.

Explore Other Platform Integrations

Deploy Knogents across Shopify, WordPress, WooCommerce, Wix, Webflow, and custom stacks.

24/7 STOREFRONT ASSISTANT

Deploy Knogents on Your Website in 2 Minutes

Connect your website sitemap, upload your documentation or product catalog, and embed with a single snippet.

Free tier includes 100 messages/mo
No credit card required
Under 20 KB vanilla script