• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed unrecognized expression error in xenforo.js

Goto this url:
Uncaught Error: Syntax error, unrecognized expression: #/xyz/0

This error is throw in xenforo.js:

$(window).on('load', function() {
    if (isScrolled || !window.location.hash)
    var hash = window.location.hash.replace(/[:.#\s\[\]]/g, ''),
        $match = $('#' + hash); //error here
    if ($match.length)
I know this error is harmless. But it's better to be fixed.

Of course this error will be thrown if we add a hash like #/xyz/0 to every forum url (in my custom route prefix too)


XenForo developer
Staff member
Fixed - I changed from trying to strip invalid characters to whitelisting alphanumeric, underscore and dash.