Any suggestions on how to shorten this would be greatly appreciated. This code takes three parameters through the URL and displays a page with targeted ads. I especially need help on how to cut down the three sections where I replace %20 with spaces. Also, here is the URL with sample parameters - http://timtechsoftware.com/ad.html?file_url=URL?file_name=FILE?keyword=KEYThis is the code of ad.html:<!DOCTYPE html><html><head><title>Download File</title><script>  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');  ga('create', 'UA-41582851-1', 'timtechsoftware.com');  ga('send', 'pageview');</script></head><body><div align=center><script type=text/javascript><!--google_ad_client = ca-pub-1582371570610820;/* Page Link Medium */google_ad_slot = 3981698399;google_ad_width = 468;google_ad_height = 15;//--></script><script type=text/javascriptsrc=http://pagead2.googlesyndication.com/pagead/show_ads.js></script>  <script>    function getParam(paramName){                //Look for parameters  var prmstr = window.location.search.substr(1);  var prmarr = prmstr.split (?);  var params = {};  for ( var i = 0; i < prmarr.length; i++) {     var tmparr = prmarr[i].split(=);     params[tmparr[0]] = tmparr[1];  }  return params[paramName];                      //Return the requested parameter}var keyword = getParam('keyword');var intIndexOfMatch = keyword.indexOf( %20 );while (intIndexOfMatch != -1){               // Loop over the string value replacing out each matching substring.keyword = keyword.replace( %20,   )      // Relace out the current instance.intIndexOfMatch = keyword.indexOf( %20 );} // Get the index of any next matching substring.var file_name = getParam('file_name');var intIndexOfMatch = file_name.indexOf( %20 );while (intIndexOfMatch != -1){                 // Loop over the string value replacing out each matching substring.file_name = file_name.replace( %20,   )    // Relace out the current instance.intIndexOfMatch = file_name.indexOf( %20 );} // Get the index of any next matching substring.var file_url = getParam('file_url');var intIndexOfMatch = file_url.indexOf( %20 );while (intIndexOfMatch != -1){                // Loop over the string value replacing out each matching substring.file_url = file_url.replace( %20,   )     // Relace out the current instance.intIndexOfMatch = file_url.indexOf( %20 );} // Get the index of any next matching substring.    document.write('<p style=text-align: center;><a href=' + file_url + '>Download ' + file_name + '</a>' + '<br/><br/>Tagged: ' + keyword + '</p>'); //Write the page  </script>  <script type=text/javascript><!--google_ad_client = ca-pub-1582371570610820;/* Rectangle Large */google_ad_slot = 9662168393;google_ad_width = 336;google_ad_height = 280;//--></script><script type=text/javascriptsrc=http://pagead2.googlesyndication.com/pagead/show_ads.js></script></div></body>  </html>
Ad page optimization?
javascript;optimization;html;url