
Jasmine
Administrator
/ Moderator
Jan 13, 2000, 3:25 AM
Post #2 of 3
(535 views)
|
Is there a particular reason you want to use JavaScript? Server Side Includes (SSI) is ideal for that purpose. I've checked all of my JavaScript books and did not find any commands that will run a cgi script. If you don't have SSI enabled on your server, you can cheat by using an image tag like this: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> <IMG SRC="/cgi-bin/run.pl" HEIGHT=3 WIDTH=3> </pre><HR></BLOCKQUOTE> Then, you can set up your run.pl to something like this: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> #!/usr/bin/perl $|=1; print "Content-Type: text/html\n\n"; print "http://yourdomain.com/transparent.gif"; # the rest of your code here </pre><HR></BLOCKQUOTE> The $|=1 will flush the Perl buffer, which will display the image without waiting for the rest of your program to finish what it's doing. The print "Content-Type: text/html\n\n"; line will tell the server and browser what kind of content follows. The print "http://yourdomain.com/transparent.gif"; directs the program to display a transparent image. Make sure you upload a transparent image to the location you're using in this line. While <IMG SRC> sample above uses a HEIGHT and WIDTH of 3 and 3 each, you can use whatever size you wish. It's recommended not to use 1x1 pixel images anymore - WebTV visitors cannot properly display 1x1 images yet.) I'm sorry I couldn't find a JavaScript solution for you. But for future reference, it may be wise to seek different solutions before you turn to any JavaScript-dependent solution. Many people turn JavaScript off in their browsers, mainly to avoid those annoying pop-up windows that are predominant in "free" web sites. Best of luck! [This message has been edited by Jasmine (edited 01-13-2000).]
|