Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Script when HTML pages loads

Status
Not open for further replies.

nochoice

Programmer
Jun 17, 2003
72
0
0
CA
I would like to automatically run a perl CGI script (survey.cgi) when an HTML page (index.html) is loaded.

How can this be done?

Thanks
 
nochoice,

In the past I've run cgi's to generate Javascript to generate server side content as a page is loading, but what you're after is probably a server side include (SSI), or else use a CGI to generate the entire content using survey.cgi's functionality as a contribution to the HTML that is currently contained in index.html

HTH
Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
you could try putting this into your html at the bottom of the page:

<!--#exec cgi=&quot;/cgi-bin/scriptname.cgi&quot; -->

works on our intranet (all IE so I have no idea about compatibility with other browsers)...

Joe
 
I put this in at the bottom of the page and all over the place and tried removing the:

<!-- -->

but nothing worked.

I decided to use javascript which works, but I would really like to get the CGI to execute when the page is loaded, any other ideas??....

Thanks for you help guys,

nochoice
 
<!--#exec cgi=&quot;/cgi-bin/scriptname.cgi&quot; -->

The green bits are the comment placeholders which are ignored by the browser (actually pretty much anything in angle braces is ignored by the browser) but the <#!--, and --> constructs are there for human readability as comments and for syntax checkers to change the colour of comments so thery're even more human readable.

The red bit, now that's the server side include (SSI), but your webserver has to be configured to run these. As for placement I think you can place these wherever you want the script to fire.

For more direction, advise on what webserver you're using, or go to the forum for that webserver, and see if anyone can point you in the right direction of good documentation on the subject.


HTH
Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top