nette.ajax.js icon indicating copy to clipboard operation
nette.ajax.js copied to clipboard

IE11 bug when absolute URL is used

Open zipper opened this issue 6 years ago • 1 comments

When absolute URL is used on AJAX link, there is new URL() used, which is not supported in IE11.

More over, when the URL is parsed, the regular expression below doesn't make any sense (or does it?):

  • There is pathname property used in string, which never should contain port number, so checking the port number is unnecessary. Port number would be in host (or even better in port).
  • The URL object always contains leading / in pathname, even though the pathname might be missing in link. So even URL eg. "http://www.example.com#foo" will return pathname equal to /. Therefore, parsedUrl['pathname'] + parsedUrl['search'] + parsedUrl['hash'] may never begin with #, but always with /.

So in my opinion, the correct condition should be if pathname from current location is the same as in parsedUrl, search is the same and hash is specified in parsedUrl. If so, return false, otherwise return true. Is that correct or am I missing something?

zipper avatar May 27 '19 09:05 zipper

I believe I've solved this by PR https://github.com/vojtech-dobes/nette.ajax.js/pull/164.

zipper avatar May 30 '19 07:05 zipper