SyntaxFix
Write A Post
Hire A Developer
Questions
document.location isn't a string.
document.location
You're probably wanting to use document.location.href or document.location.pathname instead.
document.location.href
document.location.pathname