美文网首页
js平时总结1

js平时总结1

作者: MacXin | 来源:发表于2017-09-18 13:00 被阅读0次

    1.js中提供了3对函数用来对Url编码以得到合法的Url,它们分别是escape / unescape, encodeURI / decodeURI和encodeURIComponent / decodeURIComponent

    所谓合法就是不产生歧义,

    encodeURIComponent 生成, decodeURIComponent 解析

    2.url结构

    * protocol: The protocol scheme of the URL (e.g. http:).

    * slashes: A boolean which indicates whether the protocol is followed by two forward slashes (//).

    * auth: Authentication information portion (e.g. username:password).

    * username: Username of basic authentication.

    * password: Password of basic authentication.

    * host: Host name with port number.

    * hostname: Host name without port number.

    * port: Optional port number.

    * pathname: URL path.

    * query: Parsed object containing query string, unless parsing is set to false.

    * hash: The "fragment" portion of the URL including the pound-sign (#).

    * href: The full URL.

    * origin: The origin of the URL.

    相关文章

      网友评论

          本文标题:js平时总结1

          本文链接:https://www.haomeiwen.com/subject/jxxbsxtx.html