URL parameters are your friend.
in iframe1.html put this at the top:
<script>
function getUrlVars() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
var test = getUrlVars();
console.log(test[0]);
</script>
and for your main page use:
<div id='someDiv1' style='display:none; '>
<iframe id='iframe1' src='iframe.html?visible=yes'>
</iframe>
</div>
source
share