Solved

Call a HTML file from CGI with out using anchor reference

Posted on 2000-02-14
6
178 Views
Last Modified: 2010-03-05
I am using PERL with SQL Server database for creating a dynamic web pages and getting problem to call a HTML file from CGI script without using anchor reference i.e print <a href="http://localhost/gp/abc.htm" back</a>.
I dont want to click on back anchor and the abc.htm should be directly executed.Please provide a solution.

Thanks.
0
Comment
Question by:mon1
  • 4
  • 2
6 Comments
 
LVL 3

Accepted Solution

by:
guadalupe earned 10 total points
ID: 2518671
I think this is what you want:

print "Location: http://www.domain.com\n\n";

!!!!!!!!!Carefull!!!!  If you have printed any other MIME type header like:

Content-type: text/html\n\n

The Location header will not work.  It must be the first thing you print to the browser.
0
 
LVL 3

Expert Comment

by:Raydot
ID: 2520772
Also keep in mind that the "\n\n" is vital, it won't work without it.  Would you happen to know why, Guadalupe?
0
 
LVL 3

Expert Comment

by:guadalupe
ID: 2522679
No, not exactly except that that is the format of MIME type headers.  For example:

Content-type: text/html\n\n

It must be to signal the end of the header so that what follows will not be confused as part of the header...

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:Raydot
ID: 2523049
Seems like a strange spec, and one that's hard to enforce given the way in which HTML is typically generated -- through an editor.  How does one generate the new lines then?  I guess it'll just be forever a mystery...
0
 
LVL 3

Expert Comment

by:guadalupe
ID: 2523207
Well, I'm not sure I agree with you...  The MIME header is not generated with and editor.  The mime type is generated by a Web server when it returns a document.  Since cgi are scripts we need to help the server by sending the MIME type header explicitly.  For example if you sent:

Content-type: image/gif\n\n

you could then stram out a gif.  This is how many counter programs work.
0
 
LVL 3

Expert Comment

by:guadalupe
ID: 2523212
Tha was supposed to be stream out a gif...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Perl strange behaviour 5 74
PERL export multiple query results to a JSON file 1 177
Awk Question 2 131
quoting a comma separated list 20 90
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question