
Extends the URI class to add methods for computing relative and absolute urls.
Returns the absolute path for a given url (i.e. a path beginning with '/'). If a different schemes or hosts are used, it returns the full url.
myURI.toAbsolute([base]);
Returns the relative path for a given url (i.e. a path that might include '../' for example). If a different schemes or hosts are used, it returns the full url.
myURI.toRelative([base]);
var uri1 = new URI('http://www.test.com/this/is/a/path.html'); var uri2 = new URI('http://www.test.com/this/is/an/adjacent/path.html') uri1.toRelative(uri2); //returns "../../a/path.html"
© Linux.ria.ua, 2008-2024 |