--- title: Create a standalone search box slug: '294' canonical_url: https://docs.coveo.com/en/294/ collection: javascript-search-framework source_format: adoc --- # Create a standalone search box Many web sites include a search box in each page. Performing a search request from such a standalone search box typically redirects the browser to a separate page that can display the results. This article explains how to use the [JavaScript Search Framework](https://docs.coveo.com/en/187/) to create and deploy full-fledged standalone search boxes offering advanced features such as [Coveo Machine Learning](https://docs.coveo.com/en/188/) [Query Suggestions (QS)](https://docs.coveo.com/en/1015/). > **Note** > > This article provides generic guidelines and examples for adding a Coveo-powered standalone search box to a web site or application. > > If you're working with a specific in-product integration of Coveo (for example, Coveo for Salesforce), see the corresponding product documentation instead: > > * Coveo for Salesforce: [Leverage the Coveo standalone search box](https://docs.coveo.com/en/1218#leverage-the-coveo-standalone-search-box) > * Coveo for Sitecore: [Inserting and Configuring a Global Search Box Using the Coveo for Sitecore Hive Framework](https://docs.coveo.com/en/2329/?c4scV5HiveType=tab-hive) > * Coveo for ServiceNow: [Replace the Service Portal Search Boxes](https://docs.coveo.com/en/2106/) ## Configuration In summary, to add a standalone search box to a page: . Load the required JavaScript Search Framework resources, that is: ** The `CoveoFullSearch.css` stylesheet ** The `CoveoJsSearch.Lazy.min.js` script . [Configure a search endpoint](https://docs.coveo.com/en/331/). This will allow your standalone search box to provide [Coveo ML query suggestions](https://docs.coveo.com/en/340/). Ensure that you properly [set your search hub](https://docs.coveo.com/en/365#set-the-search-hub). . Initialize a `Searchbox` component. If redirecting to an external search page, you will typically use the [`initSearchbox`](https://coveo.github.io/search-ui/globals.html#initsearchbox) function to initialize the search box, as in the [example](#example) just below (see [Initializing - Embedded in a normal page](#embedded-in-a-normal-page)). If redirecting to an internal search page, you will typically also include the search box in the main search page. In that main search page, you will instead initialize the search box externally, with the [`init`](https://coveo.github.io/search-ui/globals.html#init) function, as in the [Node.js Express application example](#nodejs-express-application-example) below (see [Initializing - Embedded in the main search page](#embedded-in-the-main-search-page)). ### Example The following example illustrates a normal page with a standalone search box using the search endpoint of the [Coveo Documentation Sample Search Interface](https://static.cloud.coveo.com/searchui/v2.10125/2/index.html), and redirecting search requests to that page. ```html
Page content...
``` If you load the above sample in a web browser, you should see something like this: When you start typing in the query box, you should get Coveo ML query suggestions: If you select Enter, or click the search button, the standalone search box should redirect your search request to the [Sample Search Interface](https://static.cloud.coveo.com/searchui/v2.10125/2/index.html): ## Node.js Express application example The following is a more complex example, which includes a standalone search box in a normal page, as well as in the main search page. More precisely, the standalone search box is included in the header of every page of a Node.js Express application. As you can see below, the initialization of that search box varies from one page to an other. ```htmlWelcome to a normal page with a standalone search box
<%- include('partials/footer') %> ``` ```html <%- include('partials/header') %>