Skip to content

Instantly share code, notes, and snippets.

@noahub
Last active December 22, 2015 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noahub/4604026c4f25a79d8f3d to your computer and use it in GitHub Desktop.
Save noahub/4604026c4f25a79d8f3d to your computer and use it in GitHub Desktop.
Pass Incoming URL parameters to iframe
<script>
//Replace #frame1 with the ID of your iframe
$('#frame1').attr('src', (function() {
return $('#frame1').attr('src') + window.location.search;
})());
</script>
If iframe URL already has a query string, append parameters using script below
<script>
//Replace #frame1 with the ID of your iframe
$('#frame1').attr('src', (function() {
return $('#frame1').attr('src') + '&' + window.location.search.subtr(1);
})());
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment