Unload Javascript Files
12
I found this to be a neat little trick for hiding(somewhat) source javacscript code from peering eyes...
This function will unload all linked javascript files so that when you view source - you see no javascript files! (Especially helpful when using FF and using web-developer tools - no linked js files are displayed) The files remain resident in memory - allowing for the functions to work.
Just call the function in the tag
This function will unload all linked javascript files so that when you view source - you see no javascript files! (Especially helpful when using FF and using web-developer tools - no linked js files are displayed) The files remain resident in memory - allowing for the functions to work.
Just call the function in the tag
function unloadJS(scriptName) {
var head = document.getElementsByTagName('head').item(0);
var js = document.getElementById(scriptName);
js.parentNode.removeChild(js);
}
function unloadAllJS() {
var jsArray = new Array();
jsArray = document.getElementsByTagName('script');
for (i = 0; i < jsArray.length; i){
if (jsArray[i].id){
unloadJS(jsArray[i].id)
}else{
jsArray[i].parentNode.removeChild(jsArray[i]);
}
}
}






- " i think that i can think as randomly as i want to always so.. " - [ el_nokio ]
<html>
<head>
<title>
testing the script
</title>
<script type="text/javascript" src="unloadjs.js"> </script>
</head>
<body onload="javascript:unloadAllJS()">
<!--
// i also tried like this into a a href tag but dosent work too :( why?
<a href="javascript:unloadAllJS();">Test</a>
-->
</body>
</html>
Regards,
Kumar S
GuyFromChennai.com