angular.js
angular.js copied to clipboard
IE11 Error: Invalid argument when parsing a link href containing a percent sign
Hi
Angular cannot render links with percent signs in it when using IE11 as a browser.
A valid email address like test%[email protected]
inside an <a ng-href="...">
logs an error to IE11 console "Error: Invalid argument" and the link is not rendered.
Example: <a ng-href="mailto:{{'test%[email protected]'}}">a link</a>
Verified in IE11 version: 11.0.9600.18098 using angular 1.4.8
Reproducible here: http://plnkr.co/edit/9ksVLjk6tFpgRPvZAXVq
Other browsers are not affected, i.e. Chrome
Stupid IE! Do you know if this happens in IE lower than 11?
FYI, it doesn't work on Edge either (but it doesn't throw the error). It just won't set the anchor's href
attribute.
@Narretz Stupid IE!² This happens in IE 10
I did some digging, and this turns out to be annoyingly complex. IE doesn't follow the URL spec for percent-encoded bytes: it follows RFC3986 instead (which states that non-escape %
s should be escaped to %25
).
I've added a unit test in case this changes in future - to prevent this is IE would be a big-ish rewrite of urlUtils.urlResolve
Same problem here. I stumbled upon this problem, when accessing obfuscated url encoded email-addresses (mailto link text node contents) with have a lot of % in it. But - it did not break on some same structured strings before. an error was thrown first when I tried to access this string in a loop: "%0E%13%06%02!%19%04%00%5E%04%00%00%03K%08K". Maybe only specific string-sequences including % are affected?...
FWIW, this seems to be fixed on Edge 18.
FWIW, this seems to be fixed on Edge 18.
Is this issue solved in IE11?