/
index.md
53 lines (37 loc) · 1.08 KB
/
index.md
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
---
title: "HTMLAnchorElement: type property"
short-title: type
slug: Web/API/HTMLAnchorElement/type
page-type: web-api-instance-property
browser-compat: api.HTMLAnchorElement.type
---
{{ApiRef("HTML DOM")}}
The **`type`** property of the {{domxref("HTMLAnchorElement")}} interface is a string that indicates the MIME type of the linked resource.
It reflects the `type` attribute of the {{HTMLElement("a")}} element.
## Value
A string.
## Example
```html
<a id="exampleLink" href="https://example.com" type="text/html">Example Link</a>
<p class="type"></p>
```
```css
#exampleLink {
font-size: 1.5rem;
}
```
```js
const anchorElement = document.getElementById("exampleLink");
const pTag = document.querySelector(".type");
console.log(anchorElement.type); // Output: "text/html"
pTag.textContent = anchorElement.type;
```
{{EmbedLiveSample("Example",100,100)}}
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{domxref("HTMLLinkElement.type")}} property
- {{domxref("HTMLSourceElement.type")}} property
- {{domxref("HTMLEmbedElement.type")}} property