I am confused as to the difference between window.location and location.href. Both appear to be acting in the same way.
What is the differe
Check this old MDN article:
Location objects have a toString method returning the current URL. You can also assign a string to window.location. This means that you can work with window.location as if it were a string in most cases. Sometimes, for example when you need to call a String method on it, you have to explicitly call toString:
window is just the global object that houses several properties, one of them is location. location also has properties, one of them is href. location.href is just window.location.href