Use location.search instead of location.pathname