[jQuery] attr("href") giving full path instead of relative in IE

[jQuery] attr("href") giving full path instead of relative in IE


I'm wanting to read in the exact string that's contained in an
anchor's href attribute in order to use it as the POST variable list
for an Ajax call to a PHP script, however in IE6 and 7 the string read
from the href attribute ends up being the absolute path, not just the
href attribute. Here's exactly what's happening:
vars = $("a").attr("href");
alert(vars);
<a href="page=2">This should return "page=2"</a>
What I get when running locally in all browsers but IE is what is
expected, an alert box with page=2 in it. In IE, I get "http://
localhost/page=2". Is there some way to get it to behave either one
way or the other in all browser instances? I really don't want to have
to detect for IE, then extract what I want from the string if it is.