New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ReferenceError when Search plugin disabled #675

StephenTaylor-Kx opened this Issue Jan 22, 2018 · 5 comments


None yet
3 participants

StephenTaylor-Kx commented Jan 22, 2018


When plugins are removed, loading a page signals an Uncaught ReferenceError.

Expected behavior

No error message.

Actual behavior

Uncaught ReferenceError
    at new t (application.ed2cc613.js:1)
    at Object.i [as initialize] (application.ed2cc613.js:1)
    at (index):292

Steps to reproduce the bug

  1. Initialise new MkDocs instance
  2. Edit mkdocs.yml:
site_name: MyDocs
plugins: []
  1. Observe expected behaviour

  2. Edit mkdocs.yml:

site_name: MyDocs
plugins: []
  name: 'material'
  1. Observe actual behaviour

Package versions

  • Python: 2.7.10
  • MkDocs: 0.17.2
  • Material: 2.5.1

Project configuration

site_name: MyDocs
plugins: []
  name: 'material'

System information

  • OS: macOS 10.13.2
  • Browser: Observed on Chrome, Safari and IE11.


No consequences observed on Chrome or Safari.

On Internet Explorer 11 our theme.js does not run:

 * Custom script for 
 * Author:
 * Version: 2018.01.17
 * Open all external links in a new window
$(function() {
    $('a').not('[href*="mailto:"]').each(function () {
		var isInternalLink = new RegExp('/' + + '/');
		if ( ! isInternalLink.test(this.href) ) {
			$(this).attr('target', '_blank');
	// Custom Search box
	// copy of HTML generated by native Search plugin 
	var html=`
    <label class="md-icon md-icon--search md-header-nav__button" for="search"></label>

    <div class="md-search" data-md-component="search" role="dialog">
      <label class="md-search__overlay" for="search"></label>
      <div class="md-search__inner">
        <form class="md-search__form" id="kx-search-form" name="search">
          <input type="text" class="md-search__input" id="kx-search-query" name="query" required placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query">
          <label class="md-icon md-search__icon" for="search"></label>
          <button type="reset" class="md-icon md-search__icon" data-md-component="reset">&#xE5CD;</button>
        <div class="md-search__output">
          <div class="md-search__scrollwrap" data-md-scrollfix>
            <div class="md-search-result" data-md-component="result">
              <div class="md-search-result__meta">
                Type a query and hit Enter
              <div class="md-search-result__list"/>
	$(" div").last().append(html);
	var serviceRoot = ''; // >>> reverse-proxy directive on Apache httpd
	var srchHandler =function( evt ) {
		// console.log(evt.which);
		if( evt.which===13 ) {
			var url = serviceRoot + "?query=" + encodeURIComponent($("#kx-search-query").val());
			window.location = url;
/*          // This query might be executed from a page called by HTTPS, so url below can only be an HTTPS call
			$.get(url, function( data ) {
				alert( 'ping!' );
				console.log( data );
				$( ".md-search-result__list" ).html( data );
*/			return false;

This comment has been minimized.


squidfunk commented Jan 22, 2018

Thanks for reporting. Search is actually implemented as a plugin from MkDocs 0.17.0 on, so the search will not work, that's correct. However, the ReferenceError is indeed an error. The JavaScript must intercept search not being present. Will provide a fix.

@squidfunk squidfunk self-assigned this Jan 22, 2018

@squidfunk squidfunk added the bug label Jan 22, 2018


This comment has been minimized.


squidfunk commented Jan 22, 2018

Fixed in #676.


This comment has been minimized.


squidfunk commented Jan 22, 2018

Released as part of 2.5.2.

@squidfunk squidfunk closed this Jan 22, 2018


This comment has been minimized.

StephenTaylor-Kx commented Jan 23, 2018

Thanks for the fast fix. My theme.js now OK in IE11.


This comment has been minimized.

linuxiamo commented Oct 1, 2018

I have a different error in the browser console that prevents the search to work.

It states:
Uncaught (in promise) SyntaxError: Unexpected token t in JSON at position 16901

I have an old copy of the documentation I was writing and at that stage I had no problems.

In my ignorance of the matter, I did a comparison between the files in the old directory and the ones in the new folder. It seems to me that the only thing changed - apart from document - is the search_index.json file.

Do you think the problem could be in this file? Is there a way to regenerate it?
Thanks for the help and for the great theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment