英文:A链接标记ie下会自动补全href

2020-04-17 08:05:18易采站长站整理

After a really good exchange with Jim in the comments below, I stand corrected. The specification does say the getAttribute should return the attribute value, not the absolute URL. The Microsoft approach is wrong.

For the time being I am using the old school object property method

linkobj.href
to return derived absolute URLs. It provides the most consistent results across all browsers.

URLs of interest
W3C REC DOM Level 2 Core specification for getAttribute
Gecko documentation for getAttribute
Microsoft documentation for getAttribute
As usual just as I was finishing this post I found this bug report on the QuickMode site which discusses the same subject.
getAttribute HREF is always absolute.html