--- title: Node.getUserData() slug: orphaned/Web/API/Node/getUserData translation_of: Web/API/Node/getUserData original_slug: Web/API/Node/getUserData ---

{{ APIRef }}{{ obsolete_header() }}

The Node.getUserData() method returns any user {{domxref("DOMUserData")}} set previously on the given node by {{domxref("Node.setUserData()")}}.

The Node.setUserData and {{domxref("Node.getUserData")}} methods are no longer available from Web content. {{domxref("Element.dataset")}} or WeakMap can be used instead.

Syntax

userData = someNode.getUserData(userKey);

Parameters

Example

var d = document.setUserData('key', 15, null);
alert(document.getUserData('key')); // 15

Specifications

Specification Status Comment
{{SpecName('DOM WHATWG', '#interface-node', 'Node')}} {{Spec2('DOM WHATWG')}} Removed from the specification.
{{SpecName('DOM3 Core', 'core.html#Node3-getUserData', 'Node.getUserData()')}} {{Spec2('DOM3 Core')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatNo}} Supported from {{CompatGeckoDesktop("1.0")}} to {{CompatGeckoDesktop("21.0")}}.
Removed in {{CompatGeckoDesktop("22.0")}} [1]
{{CompatUnknown}} {{CompatNo}} {{CompatNo}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatNo}} Supported from {{CompatGeckoMobile("1.0")}} to {{CompatGeckoMobile("21.0")}}.
Removed in {{CompatGeckoMobile("22.0")}} [1]
{{CompatVersionUnknown}} {{CompatNo}} {{CompatNo}}

[1] The method is still available from chrome scripts.

See also