How to pass search parameter to iframe?

You can use below code to pass parameter from search widget to a page with an iframe

<noscript>
 <iframe src="http://tequila512.com/store-locator/mega-embed.php" width="100%" height="1200px" scrolling="yes" frameborder=yes></iframe>
</noscript>
  
<script type="text/javascript">
 var form = 'http://tequila512.com/store-locator/mega-embed.php';
 var params = window.location.search;
 var thisScript = document.scripts[document.scripts.length - 1];
 var iframe = document.createElement('iframe');

 iframe.setAttribute('src', form + params);
 iframe.setAttribute('width', '100%');
 iframe.setAttribute('height', 1000);
 iframe.setAttribute('type', 'text/html');
 iframe.setAttribute('frameborder', '5px solid #000000');
 iframe.setAttribute('allowTransparency', 'true');
 iframe.style.border = '0';

 thisScript.parentElement.replaceChild(iframe, thisScript);
</script>

ssfwp1

ssfwp2

1+

Users who have LIKED this post:

  • Alex (Support Team)