Skip to main content


Showing posts from October, 2015

URL parameters

I have used URL parameters a few times for survey reporting. Elements which require custom markup are often more easily defined as separate webpages, these can then be embedded as iframes and tested thoroughly on their own. Example: Custom image on webpage We use two  URL parameters to form the source of a custom image on a webpage.   A simple javascript in the header makes parsing of variables possible: <!doctype html>    <html class="no-js" lang="en">    <head>    <meta charset="utf-8" />    <script>    function gup( name )    {     name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");     var regexS = "[\\?&]"+name+"=([^&#]*)";     var regex = new RegExp( regexS );     var results = regex.exec( window.location.href );     if( results == null )      return "";     else      return results[1