Return to Snippet

Revision: 59607
at September 19, 2012 19:45 by pmw57

Initial Code
function getUrlParam(name) {
    var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
    return (results && results[1]) || undefined;

Initial URL

Initial Description
Code from updated so that most jslint issues are resolved, and updated the return to use a guard condition instead of a separate if statement.

Initial Title
Get URL Parameter

Initial Tags
url, javascript, js

Initial Language