Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
The Node.getUserData() method returns any user DOMUserData set previously on the given node by Node.setUserData().
The Node.setUserData and Node.getUserData methods are no longer available from Web content. Element.dataset or WeakMap can be used instead.
Syntax
userData = someNode.getUserData(userKey);
Parameters
userKeyis 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.
Example
var d = document.setUserData('key', 15, null);
console.log(document.getUserData('key')); // 15
Specifications
| Specification | Status | Comment |
|---|---|---|
| Document Object Model (DOM) Level 3 Core Specification The definition of 'Node.getUserData()' in that specification. |
Obsolete | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getUserData | Chrome No support No | Edge No support No | Firefox No support 1 — 22 | IE ? | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android No support 4 — 22 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
Legend
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Non-standard. Expect poor cross-browser support.
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.
- Deprecated. Not for use in new websites.
