Visit Mozilla.org

DOM:window.escape

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

Encodes a string, replacing certain characters with a hexadecimal escape sequence.

[edit] Syntax

escaped = escape(regular);
  • escaped is the encoded string.
  • regular is a regular string.

[edit] Example

alert(escape("http://www.cnn.com")); // displays: http://www.cnn.com

[edit] Notes

The escape() method converts special characters (any characters that are not regular text or numbers) into hexadecimal characters, which is especially necessary for setting the values of cookies. Also useful when passing name=value pairs in the URL of a GET request, or an AJAX GET/POST request.

See also unescape, encodeURIComponent.

[edit] Specification

DOM Level 0. Not part of any standard. Mentioned in a non-normative section of ECMA-262.