Last active
July 22, 2024 14:41
-
-
Save noahub/4604026c4f25a79d8f3d to your computer and use it in GitHub Desktop.
Pass Incoming URL parameters to iframe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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