Esempio
Decodifica un URI dopo la codifica è:
var uri = "http://w3ii.com/my test.asp?name=stale&car=saab";
var
uri_enc = encodeURIComponent(uri);
var uri_dec = decodeURIComponent(uri_enc);
var res = uri_enc + "<br>" +
uri_dec;
Il risultato della res sarà:
http%3A%2F%2Fw3ii.com%2Fmy%20test.asp%3Fname%3Dst%C3%A5le%26car%3Dsaab
// Encoded URI
http://w3ii.com/my test.asp?name=stale&car=saab // Decoded URI
Prova tu stesso " Definizione e utilizzo
La funzione decodeURIComponent () decodifica un componente URI.
Suggerimento: Utilizzare il encodeURIComponent () funzione per codificare un componente URI.
Supporto per il browser
Funzione | |||||
---|---|---|---|---|---|
decodeURIComponent() | sì | sì | sì | sì | sì |
Sintassi
decodeURIComponent( uri )
valori dei parametri
Parameter | Description |
---|---|
uri | Required. The URI to be decoded |
Dettagli tecnici
Valore di ritorno: | Una stringa, che rappresenta l'URI decodificato |
---|
