• Hello,

    the plugin version 2.2.8 automatically includes the script ‘/wp-content/plugins/bookingcom-official-searchbox/assets/js/bos_main.js‘ for all pages. For all pages in which the “Booking.com Official Search Box” is NOT integrated, the browser console displays the following Javascript error, because the Javascript code does not check for the existence of the search box.

    Uncaught TypeError: sb_width is null
        <anonymous> https://www.xyz.com/portal/wp-content/plugins/bookingcom-official-searchbox/assets/js/bos_main.js:10
        <anonymous> https://www.xyz.com/portal/wp-content/plugins/bookingcom-official-searchbox/assets/js/bos_main.js:99

    Sorry, I’m not a JavaScript expert – but if you put the following JS code between lines 9 and 10, for example, the error will be avoided.

    if (sb_width == null) {
      // abort this function
      return;
    }

    I think that in general the javascript code of the plugin should check whether the DOM elements addressed in the code even exist on the page to be on the safe side.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘The script ‘bos_main.js’ causes errors on all pages without a search box’ is closed to new replies.