Some years ago I wrote a system where I'm pretty sure that I was able to execute javascript directly from the HTTP response.
What I did was to set the Content-Typeto application/javascript and then simply include the script in the response body.
Now I'm trying to do the same thing with just a simple alert:  alert('Hello world'); as the HTTP response body. But the browser doesn't execute the script but just treats it as text.
Am I doing something wrong, or have it never been possible? (It's not an ajax request).
 
     
    