[thelist] relative to absolute with getAttribute("HREF")

Kasimir K evolt at kasimir-k.fi
Sat Mar 20 16:32:20 CST 2004


Hi,

my first thought was using outerHTML and regular expressions, but then I 
had a look at:

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/getattribute.asp

where it says that:
"
Syntax
vAttrValue = object.getAttribute(sAttrName [, iFlags])

Parameters
sAttrName Required. String that specifies the name of the attribute.
iFlags Optional. Integer that specifies one or more of the following flags:
0 Default. Performs a property search that is not case-sensitive, and 
returns an interpolated value if the property is found.

1 Performs a case-sensitive property search. To find a match, the 
uppercase and lowercase letters in sAttrName must exactly match those in 
the attribute name. If the iFlags parameter for getAttribute is set to 1 
and this option is set to 0 (default), the specified property name might 
not be found.

2 Returns the value exactly as it was set in script or in the source 
document.
"

so you'd do along these lines:
if (this.is_in_msie) uri = someobject.getAttribute("HREF",2);
else uri = someobject.getAttribute("HREF");

...i guess, don't have time to test it now


.kasimir



Scott Blanchard wrote:

> If I have a relative link like "somepage.html", when I call the method 
> someobject.getAttribute("HREF") it returns an absolute URL in IE 
> (mozilla keeps it relative like it should). How can I get IE to report 
> the exact string that appears in the href attrib rather than the 
> absolute path? Any tricks or workarounds to do this?
> 



More information about the thelist mailing list