Reputation: 43
I'm working on a project which passes a variable into a iFrame with this code:
jQuery(function() {
var search = window.location.search;
jQuery(".iframe-wrapper").attr("src", jQuery(".iframe-wrapper").attr("src")+search);
});
But, when I pass through §ion=P1
in a URL, it just gives a 404.
Source of the iFrame: example.com/page?cart=1
After going to site.com/§ion=P1
the iFrame should change to example.com/page?cart=1§ion=P1
Anyway to pass through the §ion=P1
through the URL?
Upvotes: 1
Views: 722
Reputation: 1960
Please send your HTML as mine is working fine with the below:
<iframe width="500" height="200" class="iframe-wrapper" src="http://www.google.com?param=1"></iframe>
<script type="text/javascript">
$(function() {
var search = window.location.search;
search = search.replace("?","&");
$(".iframe-wrapper").attr("src", $(".iframe-wrapper").attr("src")+search);
});
</script>
Upvotes: 1