aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/htmlhyperlinkelementutils/index.html
blob: 2abe580d83381d394ba0312d21164df86eb44bb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
---
title: HTMLHyperlinkElementUtils
slug: Web/API/HTMLHyperlinkElementUtils
tags:
  - API
  - Experimental
  - Mixin
  - NeedsTranslation
  - TopicStub
  - URL API
translation_of: Web/API/HTMLHyperlinkElementUtils
---
<p>{{ApiRef("URL API")}}{{SeeCompatTable}}</p>

<p>The <strong><code>HTMLHyperlinkElementUtils</code></strong> mixin defines utility methods and properties to work with {{domxref("HTMLAnchorElement")}} and {{domxref("HTMLAreaElement")}}. These utilities allow to deal with common features like URLs.</p>

<p>There are no objects of this type, but several objects {{domxref("HTMLAnchorElement")}} and {{domxref("HTMLAreaElement")}} implement it.</p>

<h2 id="Properties">Properties</h2>

<p><em>This interface doesn't inherit any property.</em></p>

<dl>
 <dt>{{domxref("HTMLHyperlinkElementUtils.href")}}</dt>
 <dd>Is a {{domxref("USVString")}} containing the whole URL.</dd>
 <dt>{{domxref("HTMLHyperlinkElementUtils.protocol")}}</dt>
 <dd>Is a {{domxref("USVString")}} containing the protocol scheme of the URL, including the final <code>':'</code>.</dd>
 <dt>{{domxref("HTMLHyperlinkElementUtils.host")}}</dt>
 <dd>Is a {{domxref("USVString")}} containing the host, that is the <em>hostname</em>, and then, if the <em>port</em> of the URL is not empty (which can happen because it was not specified or because it was specified to be the default port of the URL's scheme), a <code>':'</code>, and the <em>port</em> of the URL.</dd>
 <dt>{{domxref("HTMLHyperlinkElementUtils.hostname")}}</dt>
 <dd>Is a {{domxref("USVString")}} containing the domain of the URL.</dd>
 <dt>{{domxref("HTMLHyperlinkElementUtils.port")}}</dt>
 <dd>Is a {{domxref("USVString")}} containing the port number of the URL.</dd>
 <dt>{{domxref("HTMLHyperlinkElementUtils.pathname")}}</dt>
 <dd>Is a {{domxref("USVString")}} containing an initial <code>'/'</code> followed by the path of the URL.</dd>
 <dt>{{domxref("HTMLHyperlinkElementUtils.search")}}</dt>
 <dd>Is a {{domxref("USVString")}} containing a <code>'?'</code> followed by the parameters of the URL.</dd>
 <dt>{{domxref("HTMLHyperlinkElementUtils.hash")}}</dt>
 <dd>Is a {{domxref("USVString")}} containing a <code>'#'</code> followed by the fragment identifier of the URL.</dd>
 <dt>{{domxref("HTMLHyperlinkElementUtils.username")}}</dt>
 <dd>Is a {{domxref("USVString")}} containing the username specified before the domain name.</dd>
 <dt>{{domxref("HTMLHyperlinkElementUtils.password")}}</dt>
 <dd>Is a {{domxref("USVString")}} containing the password specified before the domain name.</dd>
 <dt>{{domxref("HTMLHyperlinkElementUtils.origin")}} {{readonlyInline}}</dt>
 <dd>Returns a {{domxref("USVString")}} containing the origin of the URL, that is its scheme, its domain and its port.</dd>
</dl>

<h2 id="Methods">Methods</h2>

<p><em>This interface doesn't inherit any method.</em></p>

<dl>
 <dt>{{domxref("HTMLHyperlinkElementUtils.toString()")}}</dt>
 <dd>Returns a {{domxref("DOMString")}} containing the whole URL. It is a synonym for {{domxref("HTMLHyperlinkElementUtils.href")}}, though it can't be used to modify the value.</dd>
</dl>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('HTML WHATWG', '#htmlhyperlinkelementutils', 'HTMLHyperlinkElementUtils')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{ CompatibilityTable() }}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}} [1]</td>
   <td>{{CompatGeckoDesktop("22")}} [2]</td>
   <td>{{CompatNo}} [1]</td>
   <td>{{CompatNo}} [1]</td>
   <td>{{CompatNo}} [1]</td>
  </tr>
  <tr>
   <td><code>username</code> and <code>password</code></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoDesktop("26")}} [2]</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>origin </code></td>
   <td>{{CompatVersionUnknown()}}</td>
   <td>{{CompatGeckoDesktop("26")}} [2]</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}} [1]</td>
   <td>{{CompatNo}} [1]</td>
   <td>{{CompatGeckoMobile("22")}} [2]</td>
   <td>{{CompatNo}} [1]</td>
   <td>{{CompatNo}} [1]</td>
   <td>{{CompatNo}} [1]</td>
  </tr>
  <tr>
   <td><code>username</code> and <code>password</code></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoMobile("26")}} [2]</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>origin </code></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoMobile("26")}} [2]</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] Though not grouped in a single abstract interface, these methods are directly available on the interfaces that implement it, if this interface is supported.</p>

<p>[2] This mixin was called <code>URLUtils</code> before Firefox 45, and was also implemented to other by other interfaces, like {{domxref("Location")}}. From Firefox 45, the other interfaces implements their own version of the properties and methods they need.</p>

<h2 id="See_also">See also</h2>

<ul>
 <li>Interfaces implementing this one: {{domxref("HTMLAnchorElement")}}, {{domxref("HTMLAreaElement")}}
  <dl><br>
   <dd> </dd>
  </dl>
 </li>
</ul>

<dl>
 <dd> </dd>
</dl>