Core: add location global for non-browsers, fix #1788

This is a simple fix that will also prevent future problems with this.
Of course, it would be nice to add a test, but I think it's a bit beyond the scope at the moment.
Poke #1788.
Ah, that's cool. Thank you for explaining.