When you use JavaScript to make GET requests, you’ll often run into the fact that JavaScript requires the URL to be encoded. For functions that need an encoded URL, you can use encodeURIComponent to encode it.

2009-07-22_144915

. encodeURIComponent syntax:

var 儲存用變數=encodeURIComponent("被加密網址")

.

.

Example:

Paste the following code into the address bar

javascript:alert(encodeURIComponent(location.href));

2009-07-22_145001

You can also use decodeURIComponwent to restore a URL that was encoded with encodeURIComponent.

2009-07-22_145730

The syntax is the same as encodeURIComponent:

var 儲存用變數=encodeURIComponent("被加密網址") 

2009-07-22_145924