You can't know before loading a page whether it'll load non-free code. Browsers don't have a mechanism for telling you what license governs the code, and figuring out what license blocked JavaScript uses is a fair bit of work, especially since most pages use multiple JavaScript files, and which flies are downloaded may change from page to page.
Even if nearly everyone uses GPL for their JavaScript, you still need to go through this process for every site that may use non-free software, which is a royal pain.
Perhaps a "better" solution is to fight to have browsers check the license of JavaScript before loading it (either prompt the user, or have a browser setting for acceptable licenses), but that's a much harder battle than promoting JavaScript-less web pages, especially since the user has control of blocking JavaScript today.