[thelist] how to prevent hotlinking of JS files (ASP.NET)

Christian Heilmann codepo8 at gmail.com
Wed May 31 09:30:20 CDT 2006


> However, this will turn out to be a cat and mouse game after some time.
> I used google but had no luck. There are several commercial components for
> this, but my hosting is not dedicated for the time being; and installing a
> server-side component is not an option.

How about reading the location in your JS files and only allow for
execution when it is your server?

		if(window.location.host!='icant.co.uk'){
			alert('Begone, wretched thief!');
		} else {
			alert('have a cookie!');
		}

Works here:

http://icant.co.uk/sandbox/test.html
http://onlinetools.org/ul/test.html

-- 
Chris Heilmann
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/
Binaries: http://www.onlinetools.org/



More information about the thelist mailing list