I've heard a few people complain that external sites have linked to their CSS or JS files, which is both a waste of bandwidth and a potential copyright violation. Unfortunately, there is no straightforward way to prevent this from happening, and have fun trying to pursue it legally -- I was an expert witness in an Internet-related trial a few years ago, and it's amazing how much crap a lawyer can get away with it simply because the judge has no technical savvy whatsoever.
In any case, there are ways to prevent people from borrowing these file types, and it's very similar to the method described in
Article #2276, used to protect images from being swiped.
The basic concept is that you serve up the CSS or JS from ASP, and the ASP page checks the referer to make sure it's on the same domain. So, for example, you can do this:
<SCRIPT LANGUAGE=javascript SRC=js.asp></SCRIPT> <LINK REL=Stylesheet HREF=css.asp></SCRIPT> |
Where js.asp may have the following code:
<% ref = lcase(request.serverVariables("HTTP_REFERER")) if instr(ref,"localhost")>0 then response.write "document.write('HELLO');" end if %>
|
And css.asp might look like this:
<% ref = lcase(request.serverVariables("HTTP_REFERER")) if instr(ref,"localhost")>0 then response.write "body { font-size:72pt }" end if %>
|
As with the images solution, note that this will be a bigger performance hit... and may affect how JS / CSS files are cached.