Url Toolkit Versions Save

Build an absolute URL from a base URL and a relative URL (RFC 1808).

v2.1.2

6 years ago

Scheme regex is now a bit stricter.

It now must match [a-zA-Z0-9+\-.] as described in the RFC.

This means relative urls that happen to contain ‘:’ are more likely to be recognised as relative providing they contain a character that does not satisfy the above.

Also updated the README mentioning that if you know a URL is relative, you should prefix it with ./.

v2.1.1

7 years ago

Fix typescript types export

v2.1.0

7 years ago

Adds typescript type definitions.

v2.0.1

7 years ago

Fix bug in regex.

v2.0.0

7 years ago

This should be backwards compatibile with version 1 if the alwaysNormalize option is set to true. This option is required as normalization should only be performed if necessary, according to the spec.

The one exception is a combination like "http://a.com/b/cd?test=1#something" + ";x", which previously incorrectly being resolved as "http://a.com/b/;x", instead of "http://a.com/b/cd;x". To loose the last segment of the path the relative URL should be "./;x".

v1.0.11

7 years ago

Handle base url protocol being '//'.

This was not working properly when the relative url started with '/' or '//'.

v1.0.10

7 years ago
  • Handle no protocol properly.
    • a.com + z.ts => a.com/ + z.ts => a.com/z.ts not a.com + z.ts => z.ts
  • Improve performance slightly by reusing expressions.

v1.0.9

7 years ago

Handle any unicode string as domain name and allow baseURL to omit protocol and slash(es).

See https://en.wikipedia.org/wiki/Domain_name#Internationalized_domain_names

The character set allowed in the Domain Name System is based on ASCII and does not allow the representation of names and words of many languages in their native scripts or alphabets. ICANN approved the Internationalized domain name (IDNA) system, which maps Unicode strings used in application user interfaces into the valid DNS character set by an encoding called Punycode. For example, københavn.eu is mapped to xn--kbenhavn-54a.eu. Many registries have adopted IDNA.

v1.0.8

7 years ago

Handle missing '/' after domain

v1.0.7

7 years ago

Fix JSLint error.