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.
Let's avoid jshint comments. I assume this is failing because of unused. We could, instead, use a var module.