What exactly does window.location return?

I’ve got this test alert in my document:

alert (window.location.protocol + “//” + window.location.host + “/” + window.location.pathname + window.location.search);

And the result is:

https://www.mywebsite.com/categories.php?category=toys

Does this mean that if I have a “clean” url like this one (modified inside the HTACCESS file):

https://www.mywebsite.com/categories/toys

Will window.location return what’s only inside the browser window (what we can see) or does it actually return the entire bare url?

Hit F12 in your Browser and type console.log(window.location).

Then you will see, what it contains.

That’s not what I meant. I want to know if it actually reads the bare url, or if it reads what we see. Because I have a function to search the url for a substring that must contain “category”, and the cleaned url doesn’t have that keyword even though in PHP it actually does.
So if window.location sees what we (humans) see then the function won’t work. I want to know how exactly it sees the url behind the scenes.

I have tested it, otherwise I wouldn’t be asking. I can’t figure out if it does or doesn’t read the bare url, since I have .htaccess files reconfiguring my urls, and aliases set up on my localhost. I’m a beginner too, so it’s a little too complicated at this level.