非推奨
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.
概要
非推奨の escape() メソッドは16進数のエスケープシーケンスで文字列を置換します。encodeURI または encodeURIComponent を代わりに使用してください。
構文
escape(str)
引数
-
str - エンコードする文字列
説明
escape 関数はグローバルオブジェクトのプロパティです。特殊文字(@*_+-./)を除いて符号化されます。
0xFF 以下の文字は %xx、それ以上の場合は %uxxxx と表されます。
例
escape("abc123"); // "abc123"
escape("äöü"); // "%E4%F6%FC"
escape("ć"); // "%u0107"
// 特殊文字
escape("@*_+-./"); // "@*_+-./"
仕様書
| 仕様書 | ステータス | コメント |
|---|---|---|
| ECMAScript 1st Edition. | 標準 | 最初の定義 |
| ECMAScript 5.1 (ECMA-262) The definition of 'escape' in that specification. |
Standard | Defined in the (informative) Compatibility Annex B |
| ECMAScript 6 (ECMA-262) The definition of 'escape' in that specification. |
勧告候補 | Defined in the (normative) Annex B for Additional ECMAScript Features for Web Browsers |
ブラウザとの互換性
| Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari | |
|---|---|---|---|---|---|
| サポート | (有) | (有) | (有) | (有) | (有) |
| Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | |
|---|---|---|---|---|---|---|
| サポート | (有) | (有) | (有) | (有) | (有) | (有) |