Window: hashchange event - Web APIs | MDN

The hashchange event is fired when the fragment identifier of the URL has changed (the part of the URL beginning with and following the # symbol).