Adding .toString()works and avoids this error:
TypeError: url.split is not a function
function _filter() {
var url = window.location;
alert(url);
alert(url.toString().split("/")[2]);
}
When starting on this very page, the output is:
stackoverflow.com
source
share