Skip to content

About

Embeddable search box and search page elements for Captain Product Search. Built files only; served by jsDelivr.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

captain-search

<captain-search> adds a search box with instant results to any website, over a Captain App Search index. One script tag, one element, no dependencies.

<script type="module"
  src="https://cdn.jsdelivr.net/gh/runcaptain/captain-search@1.8.0/captain-search.js"
  integrity="sha384-JE4C0r/iXcnqRePQ+XK/wsFWEWRqxIR8gTfYjlnOTnd2gUaq+Y+BYHC/IRNFy/xp"
  crossorigin="anonymous"></script>

<captain-search
  endpoint="https://YOUR_TENANT.captain.dev"
  index="YOUR_INDEX"
  key="YOUR_SCOPED_KEY"
></captain-search>

For a full search page (facets, sort, pagination, URL sync), load captain-instantsearch.js instead and put the elements inside <captain-search-root>. It includes the search box.

File Holds
captain-search.js <captain-search> and createSearch (headless)
captain-search-extras.js Recent searches, Query Suggestions, completion and category rows, and prices and built image URLs for the box. captain-search.js loads it by itself, only when the box has one of those attributes, and checks it against a hash built into the box. Never add a script tag for it.
captain-instantsearch.js The same, plus <captain-search-root>, hits, pagination, stats, refinement list, sort, range and the other search page elements

Use a scoped key with allowed_origins set to your site. Never put a search key or a write key in a page.

@1.8.0 pins this exact file, and the integrity hash (one per file, in integrity.json) makes the browser refuse any other bytes. @1 follows the newest 1.x release but cannot carry a hash.

Attributes, styling, events and key setup: https://docs.captain.dev/app-search/search-widget

This repository holds only released builds. Each release is a tag (v1.8.0), and integrity.json lists each file's SRI hash.

About

Embeddable search box and search page elements for Captain Product Search. Built files only; served by jsDelivr.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors