Skip to content

Commit

Permalink
add how to force relative url to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Jenkinson committed Dec 28, 2017
1 parent a0d750d commit b97067f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ Build an absolute URL from a relative and base one.
URLToolkit.buildAbsoluteURL('http://a.com/b/cd', 'e/f/../g'); // => http://a.com/b/e/g
```

If you want to ensure that the URL is treated as a relative one you should prefix it with `./`.

```javascript
URLToolkit.buildAbsoluteURL('http://a.com/b/cd', 'a:b'); // => a:b
URLToolkit.buildAbsoluteURL('http://a.com/b/cd', './a:b'); // => http://a.com/b/a:b
```

By default the paths will not be normalized unless necessary, according to the spec. However you can ensure paths are always normalized by setting the `opts.alwaysNormalize` option to `true`.

```javascript
Expand Down

0 comments on commit b97067f

Please sign in to comment.