--- title: DOMImplementation.hasFeature slug: Web/API/DOMImplementation/hasFeature translation_of: Web/API/DOMImplementation/hasFeature ---

{{ApiRef("DOMImplementation")}}

The DOMImplementation.hasFeature() method returns a {{domxref("Boolean")}} flag indicating if a given feature is supported.

The different implementation fairly diverged in what kind of features was reported. The latest version of the spec settled to force this method to always return true, except for SVG features, where the functionnality was accurate and in use.

Syntax

flag = document.implementation.hasFeature(feature, version);

Parameters

feature
Is a {{domxref("DOMString")}} representing the feature name.
version
Is a {{domxref("DOMString")}} representing the version of the specification defining the feature.

Specifications

Specification Status Comment
{{SpecName('DOM WHATWG', '#dom-domimplementation-hasfeature', 'DOMImplementation.hasFeature')}} {{Spec2('DOM WHATWG')}} Modified to always return true except for SVG features.
{{SpecName('DOM3 Core', 'core.html#ID-5CED94D7', 'DOMImplementation.hasFeature')}} {{Spec2('DOM3 Core')}} No change from {{SpecName("DOM2 Core")}}
{{SpecName('DOM2 Core', 'core.html#ID-5CED94D7', 'DOMImplementation.hasFeature')}} {{Spec2('DOM2 Core')}} No change from {{SpecName("DOM1")}}
{{SpecName('DOM1', 'level-one-core.html#ID-5CED94D7', 'DOMImplementation.hasFeature')}} {{Spec2('DOM2 Core')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatVersionUnknown}} {{CompatGeckoDesktop("1.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
Always true for non-SVG features. {{CompatUnknown}} {{CompatGeckoDesktop("19.0")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatGeckoMobile("1.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
Always true for non-SVG features. {{CompatUnknown}} {{CompatGeckoMobile("19.0")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

See also