Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1115213 of HTMLImageElement

  • Revision slug: Web/API/HTMLImageElement
  • Revision title: HTMLImageElement
  • Revision id: 1115213
  • Created:
  • Creator: slimsag
  • Is current revision? No
  • Comment

Revision Content

{{APIRef("HTML DOM")}}

The HTMLImageElement interface provides special properties and methods  for manipulating the layout and presentation of {{HTMLElement("img")}} elements.

Properties

Inherits properties from its parent, {{domxref("HTMLElement")}}.

{{domxref("HTMLImageElement.align")}} {{obsolete_inline}}
Is a {{domxref("DOMString")}} indicating the alignment of the image with respect to the surrounding context.
{{domxref("HTMLImageElement.alt")}}
Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("alt", "img")}} HTML attribute,  thus indicating fallback context for the image.
{{domxref("HTMLImageElement.border")}} {{obsolete_inline}}
Is a {{domxref("DOMString")}} that is responsible for the width of the border surrounding the image. This is now deprecated and the CSS {{cssxref("border")}} property should be used instead.
{{domxref("HTMLImageElement.complete")}} {{readonlyInline}}
Returns a {{domxref("Boolean")}} that is true if the browser has finished fetching the image, whether successful or not. It also shows true, if the image has no {{domxref("HTMLImageElement.src", "src")}} value.
{{domxref("HTMLImageElement.crossOrigin")}}
Is a {{domxref("DOMString")}} representing the CORS setting for this image element. See CORS settings attributes for further details.
{{domxref("HTMLImageElement.currentSrc")}} {{readonlyInline}}{{experimental_inline}}
Returns a {{domxref("DOMString")}}
{{domxref("HTMLImageElement.height")}}
Is an unsigned long that reflects the {{htmlattrxref("height", "img")}} HTML attribute, indicating the rendered height of the image in CSS pixels.
{{domxref("HTMLImageElement.hspace")}} {{obsolete_inline}}
Is a long representing the space on either side of the image.
{{domxref("HTMLImageElement.isMap")}}
Is a {{domxref("Boolean")}} that reflects the {{htmlattrxref("ismap", "img")}} HTML attribute, indicating that the image is part of a server-side image map.
{{domxref("HTMLImageElement.longDesc")}} {{obsolete_inline}}
Is a {{domxref("DOMString")}} representing the URI of a long description of the image.
{{domxref("HTMLImageElement.lowSrc")}} {{obsolete_inline}}
Is a {{domxref("DOMString")}} that refers to a low-quality (but faster to load) copy of the image.
{{domxref("HTMLImageElement.name")}} {{obsolete_inline}}
Is a {{domxref("DOMString")}}.
{{domxref("HTMLImageElement.naturalHeight")}} {{readonlyInline}}
Returns an unsigned long representing the intrinsic height of the image in CSS pixels, if it is available; else, it shows 0.
{{domxref("HTMLImageElement.naturalWidth")}} {{readonlyInline}}
Returns an unsigned long representing the intrinsic width of the image in CSS pixels, if it is available; otherwise, it will show 0.
{{domxref("HTMLImageElement.referrerPolicy")}} {{experimental_inline}}
Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("referrerpolicy", "img")}} HTML attribute indicating which referrer to use in order to fetch the image.
{{domxref("HTMLImageElement.src")}}
Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("src", "img")}} HTML attribute, containing the full URL of the image including base URI.
{{domxref("HTMLImageElement.sizes")}} {{experimental_inline}}
Is a {{domxref("DOMString")}}
{{domxref("HTMLImageElement.srcset")}} {{experimental_inline}}
Is a {{domxref("DOMString")}} reflecting the {{htmlattrxref("srcset", "img")}} HTML attribute, containing a list of candidate images, separated by a comma (',', U+002C COMMA). A candidate image is a URL followed by a 'w' with the width of the images, or an 'x' followed by the pixel density.
{{domxref("HTMLImageElement.useMap")}}
Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("usemap", "img")}} HTML attribute, containing a partial URL of a map element.
{{domxref("HTMLImageElement.vspace")}} {{obsolete_inline}}
Is a long representing the space above and below the image.
{{domxref("HTMLImageElement.width")}}
Is an unsigned long that reflects the {{htmlattrxref("width", "img")}} HTML attribute, indicating the rendered width of the image in CSS pixels.
{{domxref("HTMLImageElement.x")}} {{readonlyInline}}{{experimental_inline}}
Returns a long representing the horizontal offset from the nearest layer. This property mimics an old Netscape 4 behavior.
{{domxref("HTMLImageElement.y")}} {{readonlyInline}} {{experimental_inline}}
Returns a long representing the vertical offset from the nearest layer. This property is also similar to behavior of an old Netscape 4.

Methods

Inherits properties from its parent, {{domxref("HTMLElement")}}.

{{domxref("HTMLImageElement.Image()", "Image()")}}
The Image() constructor, taking two optional unsigned long, which are the width and the height of the resource, creates an instance of HTMLImageElement , not inserted in a DOM tree.

Example

var img1 = new Image(); // HTML5 Constructor
img1.src = 'image1.png';
img1.alt = 'alt';
document.body.appendChild(img1);

var img2 = document.createElement('img'); // use DOM HTMLImageElement
img2.src = 'image2.jpg';
img2.alt = 'alt text';
document.body.appendChild(img2);

// using first image in the document
alert(document.images[0].src);

Specifications

Specification Status Comment
{{SpecName('Referrer Policy', '#referrer-policy-delivery-referrer-attribute', 'referrer attribute')}} {{Spec2('Referrer Policy')}} Added the referrerPolicy property.
{{SpecName("CSSOM View", "#excensions-to-the-htmlimageelement-interface", "Extensions to HTMLImageElement")}} {{Spec2('CSSOM View')}} Added the x and y properties.
{{SpecName('HTML WHATWG', "embedded-content.html#the-img-element", "HTMLImageElement")}} {{Spec2('HTML WHATWG')}} The following properties have been added: srcset, currentSrc and sizes.
{{SpecName('HTML5 W3C', "embedded-content-0.html#the-img-element", "HTMLImageElement")}} {{Spec2('HTML5 W3C')}} A constructor (with 2 optional parameters) has been added.
The following properties are now obsolete: name, border, align, hspace, vspace, and longdesc.
The following properties are now unsigned long, instead of long: height, and width.
The following properties have been added: crossorigin, naturalWidth, naturalHeight, and complete.
{{SpecName('DOM2 HTML', 'html.html#ID-17701901', 'HTMLImgElement')}} {{Spec2('DOM2 HTML')}} The lowSrc property has been removed.
The following properties are now long, instead of DOMString: height, width, hspace, and vspace.
{{SpecName('DOM1', 'level-one-html.html#ID-17701901', 'HTMLImgElement')}} {{Spec2('DOM1')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatVersionUnknown}} {{CompatGeckoDesktop(1.0)}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
lowSrc {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
naturalWidth, naturalHeight {{CompatVersionUnknown}} {{CompatVersionUnknown}} 9 {{CompatVersionUnknown}} {{CompatVersionUnknown}}
crossorigin {{CompatVersionUnknown}} {{CompatVersionUnknown}} 9 {{CompatVersionUnknown}} {{CompatVersionUnknown}}
complete {{CompatVersionUnknown}} {{CompatVersionUnknown}} 5[4] {{CompatVersionUnknown}} {{CompatVersionUnknown}}
srcset {{experimental_inline}} {{CompatChrome(34)}} {{CompatGeckoDesktop(32)}}[2] {{CompatNo}} 21 {{CompatSafari(7.1)}}
currentSrc {{experimental_inline}} {{CompatVersionUnknown}} {{CompatGeckoDesktop(32)}}[2] {{CompatNo}} {{CompatVersionUnknown}} {{CompatNo}}
sizes {{experimental_inline}} {{CompatVersionUnknown}} {{CompatGeckoDesktop(33)}}[3] {{CompatNo}} {{CompatVersionUnknown}} {{CompatNo}}
x and y {{CompatVersionUnknown}} 14[1] {{CompatNo}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
referrerPolicy {{experimental_inline}} {{CompatNo}} {{CompatGeckoDesktop(42)}} [5] {{CompatNo}} {{CompatNo}} {{CompatNo}}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatGeckoMobile(1.0)}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
lowSrc {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
naturalWidth, naturalHeight {{CompatUnknown}} {{CompatUnknown}} 9 {{CompatUnknown}} {{CompatVersionUnknown}}
crossorigin {{CompatUnknown}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatVersionUnknown}}
complete {{CompatUnknown}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatVersionUnknown}}
srcset {{experimental_inline}} {{CompatNo}} {{CompatGeckoMobile(32)}}[2] {{CompatNo}} {{CompatNo}} iOS 8
currentSrc {{experimental_inline}} {{CompatNo}} {{CompatGeckoMobile(32)}}[2] {{CompatNo}} {{CompatNo}} {{CompatNo}}
sizes {{experimental_inline}} {{CompatNo}} {{CompatGeckoMobile(33)}}[3] {{CompatNo}} {{CompatNo}} {{CompatNo}}
x and y {{CompatVersionUnknown}} 14[1] {{CompatNo}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
referrerPolicy {{experimental_inline}} {{CompatNo}} {{CompatGeckoMobile(42)}} [5] {{CompatNo}} {{CompatNo}} {{CompatNo}}

[1] Though, these x and y properties were removed in Gecko 7.0 {{geckoRelease("7.0")}} but later, they were restored in Gecko 14.0 {{geckoRelease("14.0")}} for compatibility reasons.

[2] This feature is behind the dom.image.srcset.enabled preference, defaulting to false.

[3] This feature is behind the dom.image.picture.enabled preference, defaulting to false.

[4] IE reports false for broken images.

[5] This property was named referrer from Firefox 42 to 44.

See also

  • The HTML element implementing this interface: {{HTMLElement("img")}}

Revision Source

<div>{{APIRef("HTML DOM")}}</div>

<p>The <strong><code>HTMLImageElement</code></strong> interface provides special properties and methods &nbsp;for manipulating the layout and presentation of {{HTMLElement("img")}} elements.</p>

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

<p><em>Inherits properties from its parent, {{domxref("HTMLElement")}}.</em></p>

<dl>
 <dt>{{domxref("HTMLImageElement.align")}} {{obsolete_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}} indicating the alignment of the image with respect to the surrounding context.</dd>
 <dt>{{domxref("HTMLImageElement.alt")}}</dt>
 <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("alt", "img")}} HTML attribute, &nbsp;thus indicating fallback context for the image.</dd>
 <dt>{{domxref("HTMLImageElement.border")}} {{obsolete_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}} that is responsible for&nbsp;the width of the border surrounding&nbsp;the image. This is now deprecated and the CSS {{cssxref("border")}} property should be used instead.</dd>
 <dt>{{domxref("HTMLImageElement.complete")}} {{readonlyInline}}</dt>
 <dd>Returns a {{domxref("Boolean")}} that is <code>true</code> if the browser has finished fetching the image, whether successful or not. It also shows&nbsp;true, if the image has no {{domxref("HTMLImageElement.src", "src")}} value.</dd>
 <dt>{{domxref("HTMLImageElement.crossOrigin")}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing the CORS setting for this image element. See <a href="/en-US/docs/HTML/CORS_settings_attributes">CORS&nbsp;settings attributes</a> for further details.</dd>
 <dt>{{domxref("HTMLImageElement.currentSrc")}} {{readonlyInline}}{{experimental_inline}}</dt>
 <dd>Returns a {{domxref("DOMString")}}</dd>
 <dt>{{domxref("HTMLImageElement.height")}}</dt>
 <dd>Is an <code>unsigned long</code>&nbsp;that reflects the {{htmlattrxref("height", "img")}} HTML attribute, indicating the rendered height of the image in CSS&nbsp;pixels.</dd>
 <dt>{{domxref("HTMLImageElement.hspace")}} {{obsolete_inline}}</dt>
 <dd>Is a <code>long</code> representing the space on either side&nbsp;of the image.</dd>
 <dt>{{domxref("HTMLImageElement.isMap")}}</dt>
 <dd>Is a {{domxref("Boolean")}} that reflects the {{htmlattrxref("ismap", "img")}} HTML attribute, indicating that the image is part of a server-side image map.</dd>
 <dt>{{domxref("HTMLImageElement.longDesc")}} {{obsolete_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing the URI of a long description of the image.</dd>
 <dt>{{domxref("HTMLImageElement.lowSrc")}} {{obsolete_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}} that&nbsp;refers&nbsp;to a low-quality (but faster to load) copy of the image.</dd>
 <dt>{{domxref("HTMLImageElement.name")}} {{obsolete_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}}.</dd>
 <dt>{{domxref("HTMLImageElement.naturalHeight")}} {{readonlyInline}}</dt>
 <dd>Returns an <code>unsigned long</code> representing the intrinsic height of the image in CSS&nbsp;pixels, if it is available; else, it shows&nbsp;<code>0</code>.</dd>
 <dt>{{domxref("HTMLImageElement.naturalWidth")}} {{readonlyInline}}</dt>
 <dd>Returns an <code>unsigned long</code> representing the intrinsic width of the image in CSS&nbsp;pixels, if it is available; otherwise, it will show&nbsp;<code>0</code>.</dd>
 <dt>{{domxref("HTMLImageElement.referrerPolicy")}} {{experimental_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("referrerpolicy", "img")}} HTML attribute indicating which referrer to use in order to&nbsp;fetch&nbsp;the image.</dd>
 <dt>{{domxref("HTMLImageElement.src")}}</dt>
 <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("src", "img")}} HTML attribute, containing the full URL of the image including base URI.</dd>
 <dt>{{domxref("HTMLImageElement.sizes")}} {{experimental_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}}</dd>
 <dt>{{domxref("HTMLImageElement.srcset")}} {{experimental_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}} reflecting the {{htmlattrxref("srcset", "img")}} HTML attribute, containing a list of candidate images, separated by a comma (<code>',', U+002C COMMA</code>). A candidate image is a URL followed by a <code>'w'</code> with the width of the images, or an <code>'x'</code> followed by the pixel density.</dd>
 <dt>{{domxref("HTMLImageElement.useMap")}}</dt>
 <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("usemap", "img")}} HTML attribute, containing a partial URL of a map element.</dd>
 <dt>{{domxref("HTMLImageElement.vspace")}} {{obsolete_inline}}</dt>
 <dd>Is a <code>long</code> representing the space above and below the image.</dd>
 <dt>{{domxref("HTMLImageElement.width")}}</dt>
 <dd>Is an <code>unsigned long</code> that reflects the {{htmlattrxref("width", "img")}} HTML attribute, indicating the rendered width of the image in CSS&nbsp;pixels.</dd>
 <dt>{{domxref("HTMLImageElement.x")}} {{readonlyInline}}{{experimental_inline}}</dt>
 <dd>Returns a <code>long</code> representing the horizontal offset from the nearest layer. This property mimics an old Netscape 4 behavior.</dd>
 <dt>{{domxref("HTMLImageElement.y")}} {{readonlyInline}} {{experimental_inline}}</dt>
 <dd>Returns a <code>long</code> representing the vertical offset from the nearest layer. This property is also similar to behavior of&nbsp;an old Netscape 4.</dd>
</dl>

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

<p><em>Inherits properties from its parent, {{domxref("HTMLElement")}}.</em></p>

<dl>
 <dt>{{domxref("HTMLImageElement.Image()", "Image()")}}</dt>
 <dd>The <code>Image()</code> constructor, taking two optional <code>unsigned</code> <code>long</code>, which are the width and the height of the resource, creates an instance of <code>HTMLImageElement</code>&nbsp;, not inserted in a DOM tree.</dd>
</dl>

<h2 id="Example">Example</h2>

<pre class="brush: js">
var img1 = new Image(); // HTML5 Constructor
img1.src = 'image1.png';
img1.alt = 'alt';
document.body.appendChild(img1);

var img2 = document.createElement('img'); // use DOM <a href="https://mxr.mozilla.org/mozilla-central/source/dom/interfaces/html/nsIDOMHTMLImageElement.idl">HTMLImageElement</a>
img2.src = 'image2.jpg';
img2.alt = 'alt text';
document.body.appendChild(img2);

// using first image in the document
alert(document.images[0].src);
</pre>

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

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Referrer Policy', '#referrer-policy-delivery-referrer-attribute', 'referrer attribute')}}</td>
   <td>{{Spec2('Referrer Policy')}}</td>
   <td>Added the <code>referrerPolicy</code> property.</td>
  </tr>
  <tr>
   <td>{{SpecName("CSSOM View", "#excensions-to-the-htmlimageelement-interface", "Extensions to HTMLImageElement")}}</td>
   <td>{{Spec2('CSSOM View')}}</td>
   <td>Added the <code>x</code> and <code>y</code> properties.</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG', "embedded-content.html#the-img-element", "HTMLImageElement")}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>The following properties have been added: <code>srcset</code>, <code>currentSrc</code> and <code>sizes</code>.</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', "embedded-content-0.html#the-img-element", "HTMLImageElement")}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>A constructor (with 2 optional parameters) has been added.<br />
    The following properties are now obsolete: <code>name</code>, <code>border</code>, <code>align</code>, <code>hspace</code>, <code>vspace</code>, and <code>longdesc</code>.<br />
    The following properties are now <code>unsigned long</code>, instead of <code>long</code>: <code>height</code>, and <code>width</code>.<br />
    The following properties have been added: <code>crossorigin</code>, <code>naturalWidth</code>, <code>naturalHeight</code>, and <code>complete</code>.</td>
  </tr>
  <tr>
   <td>{{SpecName('DOM2 HTML', 'html.html#ID-17701901', 'HTMLImgElement')}}</td>
   <td>{{Spec2('DOM2 HTML')}}</td>
   <td>The <code>lowSrc</code> property has been removed.<br />
    The following properties are now <code>long</code>, instead of <code>DOMString</code>: <code>height</code>, <code>width</code>, <code>hspace</code>, and <code>vspace</code>.</td>
  </tr>
  <tr>
   <td>{{SpecName('DOM1', 'level-one-html.html#ID-17701901', 'HTMLImgElement')}}</td>
   <td>{{Spec2('DOM1')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

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

<div>{{CompatibilityTable}}</div>

<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 (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoDesktop(1.0)}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>lowSrc</code></td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>naturalWidth</code>, <code>naturalHeight</code></td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>9</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>crossorigin</code></td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>9</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>complete</code></td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>5<sup>[4]</sup></td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>srcset</code> {{experimental_inline}}</td>
   <td>{{CompatChrome(34)}}</td>
   <td>{{CompatGeckoDesktop(32)}}<sup>[2]</sup></td>
   <td>{{CompatNo}}</td>
   <td>21</td>
   <td>{{CompatSafari(7.1)}}</td>
  </tr>
  <tr>
   <td><code>currentSrc </code>{{experimental_inline}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoDesktop(32)}}<sup>[2]</sup></td>
   <td>{{CompatNo}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatNo}}</td>
  </tr>
  <tr>
   <td><code>sizes</code> {{experimental_inline}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoDesktop(33)}}<sup>[3]</sup></td>
   <td>{{CompatNo}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatNo}}</td>
  </tr>
  <tr>
   <td><code>x</code> and <code>y</code></td>
   <td>{{CompatVersionUnknown}}</td>
   <td>14<sup>[1]</sup></td>
   <td>{{CompatNo}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>referrerPolicy</code> {{experimental_inline}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatGeckoDesktop(42)}} [5]</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Phone</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoMobile(1.0)}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>lowSrc</code></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>naturalWidth</code>, <code>naturalHeight</code></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>9</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>crossorigin</code></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>complete</code></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>srcset</code> {{experimental_inline}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatGeckoMobile(32)}}<sup>[2]</sup></td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>iOS 8</td>
  </tr>
  <tr>
   <td><code>currentSrc </code>{{experimental_inline}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatGeckoMobile(32)}}<sup>[2]</sup></td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
  <tr>
   <td><code>sizes</code> {{experimental_inline}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatGeckoMobile(33)}}<sup>[3]</sup></td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
  <tr>
   <td><code>x</code> and <code>y</code></td>
   <td>{{CompatVersionUnknown}}</td>
   <td>14<sup>[1]</sup></td>
   <td>{{CompatNo}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>referrerPolicy</code> {{experimental_inline}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatGeckoMobile(42)}} [5]</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] Though,&nbsp;these&nbsp;<code>x</code> and <code>y</code> properties were removed in Gecko 7.0 {{geckoRelease("7.0")}} but later, they were&nbsp;restored in Gecko 14.0 {{geckoRelease("14.0")}} for compatibility reasons.</p>

<p>[2] This feature is behind the <code>dom.image.srcset.enabled</code> preference, defaulting to <code>false</code>.</p>

<p>[3] This feature is behind the <code>dom.image.picture.enabled</code> preference, defaulting to <code>false</code>.</p>

<p>[4] IE reports <code>false</code> for broken images.</p>

<p>[5] This property was named <code>referrer</code> from Firefox 42 to 44.</p>

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

<ul>
 <li>The HTML element implementing this interface: {{HTMLElement("img")}}</li>
</ul>
Revert to this revision