encode a url in javascript code example Example: urlencode javascript var url = encodeURIComponent('url');