homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

IE Opens .pl file instead of executing it

 9:35 am on Apr 26, 2007 (gmt 0)

After I write a simple Helloworld.pl the IE is not executing it, instead it opens a dialog with 'Open' 'Save' option. Wats wrong...?



 3:05 pm on Apr 26, 2007 (gmt 0)

it's not being recognized as a cgi script.
try renaming it to helloworld.cgi and see if that's enough to make it work...


 6:38 pm on Apr 26, 2007 (gmt 0)

and if cgi does not work it means the http server is not setup to execute scripts.


 6:47 pm on Apr 26, 2007 (gmt 0)

welcome to WebmasterWorld

IE doesn't execute scripts!
a web server does, have you got a web server set up?


 10:17 pm on Apr 26, 2007 (gmt 0)

Assuming your server does execute Perl correctly, you'll need to tell the browser what type the file will be. You can do this in the script, by adding a mime-type definition before you start your html output.

You can tell if it's the server or the browser, use IE, download the script. Now, if the contents of the file is the actual script, then it's a server issue, if it contains the script output, i.e. the HTML code for your Hello World script, then the server has executed the script and likely you need the mime-type.

Try this:
print <<END_HTML;
Content-type: text/html;

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/html4/strict.dtd">

<title>Hello World!</title>

<p>Hello World!</p>


Without the mime-type the browser doesn't know that it's a HTML file. FF probably takes a guess, but it's only a guess. For instance, 'application/pdf' would be a PDF file, so IE would know to open it with Adobe. As IE doesn't recieve a known mime-type, it assumes it's something it can't handle, so prompts you to download the file instead. It should only download the output though as I described above.

Note the blank line between the mime-type and the HTML DTD? Very important. That bit tells the browser it's the end of the headers, and the start of the file content.

Let us know how you get on.


 9:20 am on Apr 27, 2007 (gmt 0)

Yes...its started working after I changed the Content-type from "Content-type: text/plain" to "Content-type: text/html".

Thanks folks!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved