--- 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.
userData = someNode.getUserData(userKey);
userKey
is the key to choose the specific data sought for the given node. More than one key may have been assigned on a given node, containing its own value.var d = document.setUserData('key', 15, null); alert(document.getUserData('key')); // 15
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. |
{{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.