Skip to main content

Bug Tracker

Side navigation

#2747 closed bug (fixed)

Opened April 26, 2008 12:06PM UTC

Closed January 14, 2009 04:02AM UTC

Last modified March 14, 2012 05:50PM UTC

IE7 "repairs" value of href atrribute by adding "http://..."

Reported by: Greegus Owned by:
Priority: major Milestone: 1.2.4
Component: core Version: 1.2.3
Keywords: attr href IE7 Cc:
Blocked by: Blocking:
Description

jQuery:

hraf_value = $("a").attr("href");

HTML:

<a href="123">link</a>

href_value is set to "123" in FF,Opera and also Safari.

But IE7 tranforms it into something like "http://site_direcotries_tree/123"

Attachments (2)
  • 2747.html (2.0 KB) - added by nathanhammond August 14, 2008 05:56PM UTC.

    Test Case

  • special.html (6.3 KB) - added by nathanhammond August 21, 2008 07:43PM UTC.

    Test case for href, action, and src attributes.

Change History (4)

Changed May 16, 2008 03:17AM UTC by flesler comment:1

This should work as expected, unless the link was created using innerHTML, in which case, IE always makes URLs absolute.

Is this the case ?

Changed August 07, 2008 06:40AM UTC by wouaren comment:2

Hello, i can confirm this :

IE (6&7) will auto-add the full domain name to any javascript's generated link, so this is not really a BUG of jQuery but a "feature" of IE...

But this is annoying !

Changed August 14, 2008 05:54PM UTC by nathanhammon comment:3

The test case I've attached shows that to maintain consistency we can grab the .href property in all browsers. I know that this changes the expected behavior for what is returned from .attr('href') in compliant browsers, but it gives consistent behavior--possibly more important.

The bug is fixed in IE8, but I think we need to adjust how we handle this to ensure that our response is consistent in all browsers.

Thoughts before I come up with a patch?

Changed January 14, 2009 04:02AM UTC by dmethvin comment:4

resolution: → fixed
status: newclosed

Fixed in jQuery 1.3