Click to See Complete Forum and Search --> : <script src> problems


druss
01-20-2004, 03:24 AM
i dont know if its possible but i wrote a .js file and renamed it to test.jpg i called it by using the tag <script src="test.jpg"> however nothing happened. when i renamed it to something else like test.111 it would works, so i was wondering if there was a way of which perl can write the image file when called and running the javascript code inside the image file without displaying the javascript code

thanks
Goz

Scriptage
01-20-2004, 10:17 PM
You simply can't hide your code.
If test.pl created the code by <script src="test.pl"> and I typed http://yourdomain.com/cgi-bin/test.pl into the address bar I would be prompted to download the code.

crh3675
01-25-2004, 11:58 AM
Specify the header of the code to represent the type of file you are returning in your perls script:

example:

print("Content-type: text/javascript");

or

print ("Content-type: image/jpeg");


--Craig