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