<head>
    <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
    <link rel="stylesheet" type="text/css" href="simple-ui.css">
    <meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    <script src="algoliasearch.min.js"></script>
    <script src="typeahead-algolia.min.js"></script>

    <div class="demo">
        <input class="typeahead" type="text" placeholder="Start typing" id="typeahead-algolia"  spellcheck="false"/>
    </div>

    <script type="text/javascript">
        $(document).ready(function() {
            // Replace the following values by your ApplicationID and ApiKey.
            algolia = new AlgoliaSearch('YourApplicationID', 'YourAPIKey'), 
            // replace YourIndexName by the name of the index you want to query.
            index = algolia.initIndex('YourIndexName');

            $('#typeahead-algolia').typeahead({                                
                name: 'algolia',                                                          
                remote: index.getTypeaheadTransport({"hitsPerPage": 10})
            });
        });
    </script>

</body>

<head>
    <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
    <link rel="stylesheet" type="text/css" href="simple-ui.css">
    <meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    <script src="algoliasearch.min.js"></script>
    <script src="typeahead-algolia.min.js"></script>

    <div class="demo">
        <input class="typeahead" type="text" placeholder="Start typing" id="typeahead-algolia"  spellcheck="false"/>
    </div>

    <script type="text/javascript">
        $(document).ready(function() {
            // Replace the following values by your ApplicationID and ApiKey.
            algolia = new AlgoliaSearch('YourApplicationID', 'YourAPIKey'), 
            // replace YourIndexName by the name of the index you want to query.
            index = algolia.initIndex('YourIndexName');

            $('#typeahead-algolia').typeahead({                                
                name: 'algolia',                                                          
                remote: index.getTypeaheadTransport({"hitsPerPage": 10})
            });

            // trigger an empty query at startup to resolve DNS (this avoid to solve DNS on first query)
            index.search("", {"hitsPerPage": 1});
        });
    </script>

</body>

Add empty query at startup
Add empty query at startup
