返回介绍

tinymce-util-URI

发布于 2019-05-06 06:50:01 字数 5057 浏览 1107 评论 0 收藏 0

Constructors

namesummarydefined by
URI()Constructs a new URI instance.tinymce.util.URI

Methods

namesummarydefined by
getURI()Returns the full URI of the internal structure.tinymce.util.URI
isSameOrigin()Determine whether the given URI has the same origin as this URI. Based on RFC-6454. Supports default ports for protocols listed in DEFAULT_PORTS. Unsupported protocols will fail safe: they won't match, if the port specifications differ.tinymce.util.URI
setPath()Sets the internal path part of the URI.tinymce.util.URI
toAbsPath()Converts a relative path into a absolute path.tinymce.util.URI
toAbsolute()Converts the specified URI into a absolute URI based on the current URI instance location.tinymce.util.URI
toRelPath()Converts a absolute path into a relative path.tinymce.util.URI
toRelative()Converts the specified URI into a relative URI based on the current URI instance location.tinymce.util.URI

Constructors

URI

public constructor function URI(url:String, settings:Object)

Constructs a new URI instance.

Parameters
  • url (String) - URI string to parse.
  • settings (Object) - Optional settings object.

Methods

getURI

getURI(noProtoHost:Boolean)

Returns the full URI of the internal structure.

Parameters
  • noProtoHost (Boolean) - Optional no host and protocol part. Defaults to false.

isSameOrigin

isSameOrigin(uri:tinymce.util.URI):Boolean

Determine whether the given URI has the same origin as this URI. Based on RFC-6454. Supports default ports for protocols listed in DEFAULT_PORTS. Unsupported protocols will fail safe: they won't match, if the port specifications differ.

Parameters
  • uri (tinymce.util.URI) - Uri instance to compare.
Return value
  • Boolean - True if the origins are the same.

setPath

setPath(path:string)

Sets the internal path part of the URI.

Parameters
  • path (string) - Path string to set.

toAbsPath

toAbsPath(base:String, path:String)

Converts a relative path into a absolute path.

Parameters
  • base (String) - Base point to convert the path from.
  • path (String) - Relative path to convert into an absolute path.

toAbsolute

toAbsolute(uri:String, noHost:Boolean):String

Converts the specified URI into a absolute URI based on the current URI instance location.

Examples
// Converts an relative URL to an absolute URL url will be http://www.site.com/dir/somedir/somefile.htm
var url = new tinymce.util.URI('http://www.site.com/dir/').toAbsolute('somedir/somefile.htm');
Parameters
  • uri (String) - URI to convert into a relative path/URI.
  • noHost (Boolean) - No host and protocol prefix.
Return value
  • String - Absolute URI from the point specified in the current URI instance.

toRelPath

toRelPath(base:String, path:String)

Converts a absolute path into a relative path.

Parameters
  • base (String) - Base point to convert the path from.
  • path (String) - Absolute path to convert into a relative path.

toRelative

toRelative(uri:String):String

Converts the specified URI into a relative URI based on the current URI instance location.

Examples
// Converts an absolute URL to an relative URL url will be somedir/somefile.htm
var url = new tinymce.util.URI('http://www.site.com/dir/').toRelative('http://www.site.com/dir/somedir/somefile.htm');
Parameters
  • uri (String) - URI to convert into a relative path/URI.
Return value
  • String - Relative URI from the point specified in the current URI instance.

Can't find what you're looking for? Let us know.

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文