Did you post the wrong code? The following function will return true is the URL passed to it has a path beyond the domain name and if that path has a period.
function hasExt( url ) {
var parts = url.split('/'),
last = parts.pop();
return ( parts.length > 3 ) && ( last.indexOf('.') != -1 );
}
Example: url = 'http://example.com/index.html'
will return true
but url = 'http://example.com/'
will return false