Tag Archives: encodeURIComponent function

How to encode URI components in javascript?

JavaScript provides an encodeURIComponent() function to encode uri components. This function encrypt the special characters provided in the url such as “space , / ? : @ & = + $ #“. Syntax encodeURIComponent(uri) Example Html Result How to encode URI components in javascript? URI: codesolution.org/calculate-time-between-two-dates/ Encoded URI: codesolution.org%2Fcalculate-time-between-two-dates%2F Try it