I have dynamically load some html content in iframe, first I have load the following code this function load properly
<script>
function hi()
{
debugger;
alert("sample program");
}
</script>
<body>
<input type="button" onclick="hi();"></input>
</body>
But second time just i remove the function definition and load to the iframe, but the old function result is display instead of "ReferenceError: hi is not defined" error
<script>
</script>
<body>
<input type="button" onclick="hi();"></input>
</body>
See my program http://jsfiddle.net/merbin2012/3p1wceqv/1/
This is because there is still a global function called hi defined.
>window.hi
function hi()
{
debugger;
alert("sample program");
}
You could get rid of the function:
window.hi = null;
Edit ----------------------------------------------------
Sorry didnt read the iframe part:
The browser is probably caching the page, you can trying to force it to reload, by changing the url to include the time:
<iframe src="subpage.html?_=1410772376349"/>
<iframe src="subpage.html?_=1410772384173"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.