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:  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];    }  

Embed in iframe

It is rather straight forward to embed the graphics in an iframe and using the id tag.

Just add a script by the end of the page or following the iframe tag set.

 var textvar=1;    var anothertextvar=”ext”;    document.getElementById(“test”).src = “URL/Example.html?textvar=”+textvar+”&anothertextvar=”+anothertextvar;  

0 views0 comments

Recent Posts

See All

SAS University Edition load error solution

Using SAS University Edition with VirtualBox in Fedora requires kernel signing of 3 modules. Avoid this by disabling Secure Boot in BIOS settings. Secure Boot makes it impossible to load nonauthorized