JavaScript

How To Decode a URL In JavaScript

You can use the decodeURIComponent() function to decode URI components in Javascript. It does the opposite of encodeURIComponent(). It uses a UTF-8 encoding scheme to decode URI components.
 

Example: Decode a URL
var url = 'https://stackhowto.com/search?q=Welc%C3%B6m%20t%C3%B6%20St%40ckH%C3%B6wT%C3%B6'

var urlDecode = decodeURIComponent(url);
console.log(urlDecode);

Output:

https://stackhowto.com/search?q=Welcöm tö St@ckHöwTö
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *