unescape()
is not strictly deprecated (as in "removed from the Web standards"), it is defined in
Annex B
of the ECMA-262 standard, whose introduction states:
… All of the language features and behaviours specified in this annex have one or more undesirable characteristics and in the absence of legacy usage would be removed from this specification. …
… Programmers should not use or assume the existence of these features and behaviours when writing new ECMAScript code. …
unescape()
function computes a new string in which hexadecimal escape sequences are replaced with the character that it represents. The escape sequences might be introduced by a function like
escape
. Usually,
decodeURI
or
decodeURIComponent
are preferred over
unescape
.
unescape
to decode URIs, use
decodeURI
代替。
unescape(str)
str
A string to be decoded.
A new string in which certain characters have been unescaped.
unescape
function is a property of the
全局对象
.
unescape('abc123'); // "abc123"
unescape('%E4%F6%FC'); // "äöü"
unescape('%u0107'); // "ć"
| 规范 |
|---|
|
ECMAScript (ECMA-262)
The definition of 'unescape' in that specification. |
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
unescape
弃用
|
Chrome 1 | Edge 12 | Firefox 1 | IE 3 | Opera 3 | Safari 1 | WebView Android 1 | Chrome Android 18 | Firefox Android 4 | Opera Android 10.1 | Safari iOS 1 | Samsung Internet Android 1.0 | nodejs 0.1.100 |
完整支持
弃用。不要用于新网站。