I am developing an extension in which i need to generate URL of website differently.Here is the structure of my code i am using
<script>
var URL="";
function genURL(){
URL="xyz";
}
</script>
<body onload="genURL()">
<iframe id="if1" src="abc"></iframe>
</body>
<script>
document.getElementById("if1").src=URL;
</script>
above code is wrong as i cannot access element if1 in script code aboveits definitions and URL is not available in below script code.If we can access URL in Script code below , my problem will be solved. Or else is there a way to generate URL directly in iframe .
Thanks
var URL = "xyz"genURL, soURLwon't be set...varkeyword is omitted. It won't work in IE, but I guess that doesn't really matter for a chrome extension. Still, the bigger problem is thatgenURLisn't called at all,document.getElementById()function or as soon as the dom is loaded