[jQuery] browser compatibility issue with jQuery(this).attr("href");
Hello,
I wrote a script that starts like this:
jQuery('/html/body//div[@class=node]//a').each(function(i){
var $hr = jQuery(this).attr("href");
.....)};
What I noticed is the following for relative (ex: href="/mypage")
URLs:
var $hr = this.href; //returns URL with http:// (ex:
http://mysite/mypage)
However:
var $hr = jQuery(this).attr("href"); //returns URL with http://
(ex: http://mysite/mypage)
in ie6 and actual URL (ex: /mypage)
in firefox.
I am confused, I really appreciate if anyone can explain this
behavior. And let me know how I can get the actual URL in both
browser.
Thanks and reagards,
AK