<script type="text/javascript">
var form = 'ParamCatch.html';
var params = window.location.search;
var thisScript = document.scripts[document.scripts.length - 1];
var iframe = document.createElement('iframe');
My Test:
- Two HTML pages, Main.html and ParamCatch.html
ParamCatch.html contains the embedded DataPage set to receive parameter as filter for Tabular Report
Main.html
> contains the script above
> tested using Main.html?paramname=paramvalue
> ParamCatch.html got the parameters and displayed the correct data
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
Ba2sai
Hey,
I was searching for a solution to pass browser parameter into another html page inside an iframe and I stumbled on a neat code and tweaked it. It worked for me so I'm sharing this here.
http://help.pardot.com/customer/portal/articles/2126647-passing-url-parameters-from-browser-to-iframe
<noscript>
<iframe src="ParamCatch.html" width="100%" height="500" type="text/html" frameborder="0" style="border: 0">
</iframe>
</noscript>
<script type="text/javascript">
var form = 'ParamCatch.html';
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', 500);
iframe.setAttribute('type', 'text/html');
iframe.setAttribute('frameborder', 0);
iframe.setAttribute('allowTransparency', 'true');
iframe.style.border = '0';
thisScript.parentElement.replaceChild(iframe, thisScript);
</script>
My Test:
- Two HTML pages, Main.html and ParamCatch.html
ParamCatch.html contains the embedded DataPage set to receive parameter as filter for Tabular Report
Main.html
> contains the script above
> tested using Main.html?paramname=paramvalue
> ParamCatch.html got the parameters and displayed the correct data
Cheers!
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.