Return to Snippet

Revision: 47218
at June 2, 2011 23:01 by jquery4u


Initial Code
var url = $(location).attr('href'); //get current url
//OR
var url = 'folder/index.html?param=#23dd&noob=yes'; //or specify one
 
var encodedUrl = encodeURIComponent(url);
console.log(encodedUrl);
//outputs folder%2Findex.html%3Fparam%3D%2323dd%26noob%3Dyes

Initial URL
http://www.jquery4u.com/snippets/jquery-decode-url-string/

Initial Description


Initial Title
jQuery Encode/Decode URL String

Initial Tags
jquery

Initial Language
JavaScript