Ну тогда используй pathname:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" ></script>
<script type="text/javascript">
$(document).ready(function() {
$('a').click(function() {
alert(this.pathname);
return false;
});
});
</script>
<a href="http://test.tk/test/file.php">http://test.tk/test/file.php</a><br>
<a href="//test.tk/some/path/file.php">//test.tk/some/path/file.php</a><br>
<a href="test/file.php">test/file.php</a><br>
<a href="file.php">file.php</a>
</body>
</html>