4 examples of 'urlencode javascript' in JavaScript

Every line of 'urlencode javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
184function urlEncode_(str) {
185 return encodeURIComponent(String(str));
186}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

60function urlencode(str) {
61 str = (str + '').toString();
62
63 return encodeURIComponent(str)
64 .replace(/!/g, '%21')
65 .replace(/'/g, '%27')
66 .replace(/\(/g, '%28')
67 .replace(/\)/g, '%29')
68 .replace(/\*/g, '%2A')
69 .replace(/%20/g, '+');
70}
74function base64urlEncode(str) {
75 return new Buffer(str).toString('base64');
76}
191function base64urlEncode(s) {
192 return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
193}

Related snippets