tencent cloud

URL.setHref
Last updated:2025-03-11 20:21:21
URL.setHref
Last updated: 2025-03-11 20:21:21
URL.setHref is used to set the serialized URL.
setHref(href: string): void added.

Parameters

Parameter
Type
Description
href
string
The serialized URL to be set.

Return

Type
Description
void
No data returned.

Samples

import url from 'pts/url';

export default function () {
const u = 'http://user:pass@www.example.com:8080/test/index.html?name=xxx&age=18#worker';

const uu = new url.URL(u);
console.log(uu.href()); // http://user:pass@www.example.com:8080/test/index.html?name=xxx&age=18#worker
uu.setHref('https://console.tencentcloud.com');
console.log(uu.href()); // https://console.tencentcloud.com/
}

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback