Change location.path to document.location.path.