Hi everyone.
I would like to know if it's possible to clean up my scripts, or if you
will, 'make them biodegradable'. Some of my smaller script will be
download to the users browser, but I would like to clear them once I am
done, so as not to bog down the browser more than needed. I have tried
removing the script element, and/or setting the src attribute to null
and '', but the script itself still remains.
Here is some example code.
<head>
<script id="remove_me" type="text/javascript">
function foo(){
alert("bar!");
}
</script>
<script type="text/javascript">
function removeScript(){
script = document.getElementById('remove_me');
script.src = "";
script.parentNode.removeChild(script);
delete script;
}
</script>
</head>
<body onload="removeScript();"><body>
</html>
Note that there is no colsure created in this script, so the script
should be removed. But when I call upon foo() from the JavaScript
console in Firefox, it's still there!
Would anyone know how I can remove the entire script from RAM?
Many thanks.
Daz.