tags:

views:

32

answers:

1

Suppose I have a link <a href='?action=run'>, on a webpage wwww.example.com/foo.html

In Firefox, attr('href') returns '?action=run'

In IE, it returns 'http://www.example.com/foo.html?action=run'

  1. When using attr('href'), usually which behaviour is expected (are there any standards?)
  2. Is it possible to make IE returns just '?action=run' too?
+1  A: 

jQuery should be handling this for you already, you can see it in the source here, and in a quick test here.

jQuery normalizes it if the browser doesn't already, checked via $.support.hrefNormalized (false in IE), it does this for href, src and style attributes.

Is it possible you're using a very old version of jQuery that didn't do this? If so upgrading is your answer. Also be sure that you are indeed using .attr('href') to get the normalization, and not .href directly.

Nick Craver
I am using jQUery 1.4.2 and I am quite sure that I am using attr('href'). Will do a quick check back @ work again.
Extrakun