/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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
URL: http://www.jquery4u.com/snippets/jquery-decode-url-string/