title: Load a specifc source in iframe based on URL
body: <p>I am a very, very beginner at coding. And I think I am close to achieving something, but just can't get it to work just right.</p>
  
  <p>Our company loads our product database into a specific program that is searchable by customers in our industry. Until I figure out how to tie into the API they provide, our website lists all of our products through iframes.</p>
  
  <p>Quite often I have a client asking me to provide them a direct link to a specific product number. I'd rather not try to create a separate page with an iframe specifically linked to that one product, so I've been searching online for how to accomplish all of this. </p>
  
  <p>My site is promo-central.com</p>
  
  <p>I built a special search page at promo-central.com/searchby.html</p>
  
  <p>I am hoping for some way to be able to give my client a link to a product (SBP26 for example) in the form of something like www.promo-central.com/searchby.html?SBP26</p>
  
  <p>That will then tell the iframe on that page to load the src based on that extra info in the URL.</p>
  
  <p>Here's what I currently have:</p>
  
  <p>Link that i'd like to work: <a href="http://promo-central.com/searchby.html?itemnum=sbp26" rel="nofollow">http://promo-central.com/searchby.html?itemnum=sbp26</a></p>
  
  <p>The URL that should be called in this situation to correctly load the iframe would be <a href="http://www.promoplace.com/ws/ws.dll/StartSrch?DistID=36182&amp;itemnum=sbp26" rel="nofollow">http://www.promoplace.com/ws/ws.dll/StartSrch?DistID=36182&amp;itemnum=sbp26</a></p>
  
  <p>Here's the code on the page:</p>
  
  <pre><code>&lt;iframe height="100%" name="WE_Frame" id="WE_Frame" src="http://www.promoplace.com/ws/ws.dll?DistID=36182"&gt;&lt;/iframe&gt;
  &lt;script&gt;
  (function() {
  var frameBaseSRC = document.getElementById("WE_Frame").src;
  var frameQueryString = document.location.href.split("itemnum=")[1];
   if (frameQueryString != undefined) {
    document.getElementById("WE_Frame").src = frameBaseSRC + "&amp;itemnum=" + frameQueryString;
   }
  })();
  &lt;/script&gt;
  </code></pre>
  
  <p>To me this looks like it should work, but it doesn't work for me. </p>
  
  <p>Am I way off? Or do I just have some kind of small issue?</p>
  
  <p>I REALLY appreciate any help, or alternate ideas you may have.</p>
  
  <p>Thanks in advance!</p>