What is the difference between encodeURI() and encodeURIComponent() in JavaScript?

JavaScript provides two methods for encoding characters to URL-safe strings. Do you know when to use each one?


This content originally appeared on 30 seconds of code and was authored by 30 seconds of code

JavaScript provides two methods for encoding characters to URL-safe strings. Do you know when to use each one?


This content originally appeared on 30 seconds of code and was authored by 30 seconds of code


Print Share Comment Cite Upload Translate
APA
30 seconds of code | Sciencx (2022-12-01T21:23:10+00:00) » What is the difference between encodeURI() and encodeURIComponent() in JavaScript?. Retrieved from https://www.scien.cx/2021/01/07/what-is-the-difference-between-encodeuri-and-encodeuricomponent-in-javascript/.
MLA
" » What is the difference between encodeURI() and encodeURIComponent() in JavaScript?." 30 seconds of code | Sciencx - Thursday January 7, 2021, https://www.scien.cx/2021/01/07/what-is-the-difference-between-encodeuri-and-encodeuricomponent-in-javascript/
HARVARD
30 seconds of code | Sciencx Thursday January 7, 2021 » What is the difference between encodeURI() and encodeURIComponent() in JavaScript?., viewed 2022-12-01T21:23:10+00:00,<https://www.scien.cx/2021/01/07/what-is-the-difference-between-encodeuri-and-encodeuricomponent-in-javascript/>
VANCOUVER
30 seconds of code | Sciencx - » What is the difference between encodeURI() and encodeURIComponent() in JavaScript?. [Internet]. [Accessed 2022-12-01T21:23:10+00:00]. Available from: https://www.scien.cx/2021/01/07/what-is-the-difference-between-encodeuri-and-encodeuricomponent-in-javascript/
CHICAGO
" » What is the difference between encodeURI() and encodeURIComponent() in JavaScript?." 30 seconds of code | Sciencx - Accessed 2022-12-01T21:23:10+00:00. https://www.scien.cx/2021/01/07/what-is-the-difference-between-encodeuri-and-encodeuricomponent-in-javascript/
IEEE
" » What is the difference between encodeURI() and encodeURIComponent() in JavaScript?." 30 seconds of code | Sciencx [Online]. Available: https://www.scien.cx/2021/01/07/what-is-the-difference-between-encodeuri-and-encodeuricomponent-in-javascript/. [Accessed: 2022-12-01T21:23:10+00:00]
rf:citation
» What is the difference between encodeURI() and encodeURIComponent() in JavaScript? | 30 seconds of code | Sciencx | https://www.scien.cx/2021/01/07/what-is-the-difference-between-encodeuri-and-encodeuricomponent-in-javascript/ | 2022-12-01T21:23:10+00:00
https://github.com/addpipe/simple-recorderjs-demo