Turbo wrote:
How to get absolute uri by combining the baseuri and the relative uri
in an html page using javscript?
In the simplest case, strip any characters after the last slash in the
base URI and concatenate the relative URI:
absoluteUri = baseUri.substring(0,
baseUri.lastIndexOf('/') + 1)
+ relativeUri;
For that to succeed, the baseUri must be a canonical, hierarchical URI.
For example, the path component must consist of at least one slash:
//www.example.com/
not
//www.example.com
Normalisation of the resulting URI would be left to whatever's going to
use it - pointless, but harmless, dot-segments will not be removed.
The general case requires much more work, though it's certainly
feasible. It's more likely that you'd want something between the two, if
the above isn't sufficient.
RFC 3986 defines the resolution and normalisation processes.
Mike