var f = new URL('/en-US/docs', d); // Creates a URL pointing to 'https://developer.mozilla.org/en-US/docs'
var g = new URL('/en-US/docs', "https://developer.mozilla.org/fr-FR/toto");// Creates a URL pointing to 'https://developer.mozilla.org/en-US/docs'
var h = new URL('/en-US/docs', a); // Creates a URL pointing to 'https://developer.mozilla.org/en-US/docs'
var i = new URL('/en-US/docs', ''); // Raises a SYNTAX ERROR exception as '/en-US/docs' is not valid
var j = new URL('/en-US/docs'); // Raises a SYNTAX ERROR exception as 'about:blank/en-US/docs' is not valid
var k = new URL('http://www.example.com', 'https://developers.mozilla.com');// Creates a URL pointing to 'https://www.example.com'
var l = new URL('http://www.example.com', b); // Creates a URL pointing to 'https://www.example.com'
5. 静态方法
方法
描述
URL.createObjectURL()
URL.revokeObjectURL()
三、Location
属性
实现URLUtils的属性(除URLUtils.searchParams以外)
方法
方法
描述
Location.assign()
加载给定URL的内容资源到这个Location对象所关联的对象上。
Location.reload()
Location.replace()
四、HTMLAnchorElement
属性
HTMLAnchorElement.accessKey
HTMLAnchorElement.charset
Is a DOMString representing the character encoding of the linked resource.
HTMLAnchorElement.coords
Is a DOMString representing a comma-separated list of coordinates.
HTMLAnchorElement.download
Is a DOMString indicating that the linked resource is intended to be downloaded rather than displayed in the browser. The value represent the proposed name of the file. If the name is not a valid filename of the underlying OS, browser will adapt it. The value is a URL with a scheme like http:, file:, data: or even blob: (created with URL.createObjectURL).
HTMLAnchorElement.hreflang
Is a DOMString that reflects the hreflang HTML attribute, indicating the language of the linked resource.
HTMLAnchorElement.media
Is a DOMString that reflects the media HTML attribute, indicating the intended media for the linked resource.
HTMLAnchorElement.name
Is a DOMString representing the anchor name.
HTMLAnchorElement.rel
Is a DOMString that reflects the rel HTML attribute, specifying the relationship of the target object to the linked object.
Returns a DOMTokenList that reflects the rel HTML attribute, as a list of tokens.
HTMLAnchorElement.rev
Is a DOMString representing that the rev HTML attribute, specifying the relationship of the link object to the target object.
HTMLAnchorElement.shape
Is a DOMString representing the shape of the active area.
HTMLAnchorElement.tabindex
Is a long containing the position of the element in the tabbing navigation order for the current document.
HTMLAnchorElement.target
Is a DOMString that reflects the target HTML attribute, indicating where to display the linked resource.
HTMLAnchorElement.text
Is a DOMString being a synonym for the Node.textContent property.
HTMLAnchorElement.type