CGI: VBScript CGI: Difference between revisions

Jump to navigation Jump to search
m
Minor cleanup
(Punctuation and grammatical changes; some clarification.)
m (Minor cleanup)
Line 62: Line 62:


The shebang is ''''!''' followed by the path to the executable that will run the script, which in this case is the Windows Script Host '''cscript.exe'''<br />
The shebang is ''''!''' followed by the path to the executable that will run the script, which in this case is the Windows Script Host '''cscript.exe'''<br />
The '''//nologo''' prevents cscript from displaying a banner, otherwise a malformed header error is produced.
The '''//nologo''' prevents cscript from displaying a banner, otherwise a malformed header error would be produced.


===Content-type===
===Content-type===
Following the shebang, a content type header is required. This is obligatory otherwise again a malformed header error is produced.
Following the shebang, a content type header is required. This also is obligatory, otherwise a malformed header error would be produced.
<pre>
<pre>
Wscript.Echo "Content-type: text/html" & vbLF & vbLF
Wscript.Echo "Content-type: text/html" & vbLF & vbLF
Line 77: Line 77:
|-
|-
|
|
* Edit file test1.vbs to have content as shown on right.
* Edit file test1.vbs to have the contents as shown on right.
* Start Apache if not already running
* Start Apache if not already running
* Enter: <nowiki>http://localhost:8081/vbs_test/test1.vbs</nowiki><br /> (or refresh browser page)
* Enter: <nowiki>http://localhost:8081/vbs_test/test1.vbs</nowiki><br /> (or refresh browser page)
Line 101: Line 101:
|-
|-
|
|
* Create a new file test2.vbs with content as shown on right.
* Create a new file test2.vbs with the contents as shown on right.
* Start Apache if not already running
* Start Apache if not already running
* Enter: <nowiki>http://localhost:8081/vbs_test/test2.vbs</nowiki>
* Enter: <nowiki>http://localhost:8081/vbs_test/test2.vbs</nowiki>
Line 119: Line 119:
|
|
The script produces output as shown on right.<br />
The script produces output as shown on right.<br />
Note: Date and time defined by your PC<br />
Note: Date and time are defined by your PC<br />
Refresh page and note the time updates (dynamic page).
Refresh page and note that the time updates (dynamic page).


|style="background:#f5f5f5;"|
|style="background:#f5f5f5;"|
Line 136: Line 136:
Although the majority of html tags are optional you do need to<br />
Although the majority of html tags are optional you do need to<br />
include a minimum set of tags as per a standard html page.<br />
include a minimum set of tags as per a standard html page.<br />
Otherwise the page may break when opened in different browsers.
Otherwise the page may fail when opened in different browsers.


* Create a new file test3.vbs with content as shown on right.
* Create a new file test3.vbs with the contents as shown on right.
* Start Apache if not already running
* Start Apache if not already running
* Enter: <nowiki>http://localhost:8081/vbs_test/test3.vbs</nowiki>
* Enter: <nowiki>http://localhost:8081/vbs_test/test3.vbs</nowiki>
Line 166: Line 166:
'''Note:'''
'''Note:'''
The page title is now displayed on the browser tab and in<br />
The page title is now displayed on the browser tab and in<br />
the browser title bar. There are no major changes in output.
the browser title bar. There are no other changes in output.


|style="background:#f5f5f5;"|
|style="background:#f5f5f5;"|

Navigation menu