I am creating a JS library that has a requirement to look at the form [action] and [href] values and resolve them to absolute URLs.
For example, I am on http: // a / b / c / d; p? Q and meet the href value for "../g" (suppose there is no <base> element). The resulting absolute will be: http: // a / b / g .
Is there a JS library that already does this? I had to believe it.
For more information on what you need, spec: http://tools.ietf.org/html/rfc3986#section-5.4
, .href A ( .getAttribute('href'), .href) () URL-.
.href
.getAttribute('href')
JS, DOM: https://gist.github.com/1088850 ( , JS ).
URL- :
u = (new URL("?newSearch", "http://a.example/with/a/long/path.file?search#fragment")).href
( http://a.example/with/a/long/path.file?newSearch)
http://a.example/with/a/long/path.file?newSearch
, , :
u = (new URL("?newSearch", document.location)).href
URL URL (, , , , ..).
URL
Source: https://habr.com/ru/post/1769760/More articles:C # 2010 Express - Missing pointer - c #how to remove or destroy wx.panel from its parent (another wx.panel object)? - pythonHow to change my SVN account in a subtitle - eclipseGet a key metric for an individual page in Sitecore - analyticsConverting SqlCommand to T-SQL - c #SqlCommand for T-SQL - c #Value assigned to a variable or variable assigned to a name - terminologyСоздание объекта внутри имен <-() дает ошибку. Как объяснить? - variable-assignmentIs it possible to have forms in the sub-namespace of a VB.NET WinForms project? - namespacesAlternative for PHP GD library in python - pythonAll Articles