This article mainly introduces node. url in js. the resolve method is described in this article. resolve Method description, syntax, receiving parameters, use instances and implementation source code. For more information, see
Method description:
Insert or replace the original tag for the URL or href. (You can see the example if you don't understand it)
Syntax:
The Code is as follows:
Url. resolve (from,)
Because this method belongs to the url module, You need to introduce the url module (var url = require ("url") before use "))
Receiving parameters:
From Source Address
To tag to be added or replaced
Example:
The Code is as follows:
Var url = require ('url ');
Var a = url. resolve ('/one/two/three', 'four '),
B = url. resolve ('HTTP: // example.com/','/one '),
C = url. resolve ('HTTP: // example.com/one', '/two ');
Console. log (a + "," + B + "," + c );
// Output result:
/// One/two/four
// Http://example.com/one
// Http://example.com/two
Source code:
The Code is as follows:
Url. prototype. resolve = function (relative ){
Return this. resolveObject (urlParse (relative, false, true). format ();
};