url.protocol
获取和设置网址的协议部分。
【Gets and sets the protocol portion of the URL.】
const myURL = new URL('https://example.org');
console.log(myURL.protocol);
// Prints https:
myURL.protocol = 'ftp';
console.log(myURL.href);
// Prints ftp://example.org/ 分配给 protocol 属性的无效 URL 协议值将被忽略。
【Invalid URL protocol values assigned to the protocol property are ignored.】