angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

IE11 Error: Invalid argument when parsing a link href containing a percent sign

Open pneyer opened this issue 9 years ago • 7 comments

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 screen shot 2015-11-26 at 16 13 47

pneyer avatar Nov 26 '15 15:11 pneyer

Stupid IE! Do you know if this happens in IE lower than 11?

Narretz avatar Nov 26 '15 16:11 Narretz

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.

gkalpak avatar Nov 26 '15 19:11 gkalpak

@Narretz Stupid IE!² This happens in IE 10 angular_bug

gutierri avatar Nov 27 '15 06:11 gutierri

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

andypatterson avatar Dec 07 '15 15:12 andypatterson

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?...

lsblsb avatar Feb 28 '16 14:02 lsblsb

FWIW, this seems to be fixed on Edge 18.

gkalpak avatar Jan 03 '19 16:01 gkalpak

FWIW, this seems to be fixed on Edge 18.

Is this issue solved in IE11?

mooncser avatar Feb 12 '20 05:02 mooncser