Unload Javascript Files





11
Date Submitted Mon. Nov. 6th, 2006 9:12 AM
Revision 1 of 1
Scripter Casper42
Tags JavaScript
Comments 3 comments
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

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]);
    }
  }       
}
 

Jeremy Edmiston

Comments

Comments unloadJS()?
Wed. Nov. 8th, 2006 7:35 AM    Scripter ctiggerf
Comments Revisions...
Wed. Nov. 15th, 2006 7:35 AM    Scripter Casper42
  Comments revisions
Tue. Nov. 28th, 2006 4:33 PM    Scripter bertheymans

Voting