I was wondering if you can prevent this by looking at the "Accept" header in the request but it seems accept is "/" for scripts. I'd expect the browsers rather to send "application/javascript".
Then the answer from my server will be 400 because I don't have a javascript representation of this url.