I would like to grab the parameters from a page that contains an iframe
, and append the parameters to the src
of the iframe
.
Example:
PAGE CONTAINING IFRAME--
http://www.example.com/pref.html?c=%433r3jutlut9se%23&e=test%40example.com
IFRAME IN THE ABOVE PAGE--
<iframe id="myiframe" name="myiframe" src="prefcontent.aspx" frameborder="0"
width="100%" height="800"></iframe>
Here's one of the many things I've tried, which I thought would work in theory, but I had no luck with it:
<script language="javascript">
$(function() {
var loc = window.location.toString(),
params = loc.split('?')[1],
params2 = loc.split('&')[2],
iframe = $('#myiframe');
console.log(params);
iframe.src = iframe.src + '?' + params + '&' + params2;
});
</script>