HTML5技术

URL相关Web APIs - 妙音天女(2)

字号+ 作者:H5之家 来源:H5之家 2017-03-26 18:02 我要评论( )

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

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

  • Location表示其关联的对象所展示的页面的地址等信息,对该对象的修改会反映到关联的对象上。 Document 和 Window 接口都有一个关联的Location,可以分别用Document.location和Window.location来访问它们对应的Location。
  • 属性

    实现URLUtils的属性(除URLUtils.searchParams以外)

  • 方法

  • 实现URLUtils的方法
  • Location本身的方法
  • 方法

    描述

    Location.assign()

    加载给定URL的内容资源到这个Location对象所关联的对象上。

    Location.reload()

    Location.replace()

    四、HTMLAnchorElement

  • HTMLAnchorElement 接口表示超链接元素,并提供一些特别的属性和方法以用于操作这些元素的布局和显示。
  • 属性

  • 继承自父类HTMLElement的属性
  • 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

     

    1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

    相关文章
    • URL编码参考手册 - 妙音天女

      URL编码参考手册 - 妙音天女

      2017-03-26 18:01

    • HTTP状态码 - 妙音天女

      HTTP状态码 - 妙音天女

      2017-03-25 13:01

    • 列表总结Canvas和SVG的区别 - 妙音天女

      列表总结Canvas和SVG的区别 - 妙音天女

      2017-03-17 10:00

    • canvas的beginPath和closePath分析总结,包括多段弧的情况 - 妙音天女

      canvas的beginPath和closePath分析总结,包括多段弧的情况 - 妙音天

      2017-03-17 09:03

    网友点评