Solved

Loading an existing html file into a browser

Posted on 1998-07-01
7
148 Views
Last Modified: 2013-12-25
How can I load an existing HTML file into a browser from within a C cgi script? I 'm currently creating the HTML file on the fly but I want to create it only once and put it in a directory and then force the browser to reference it..
0
Comment
Question by:barlav
7 Comments
 
LVL 7

Expert Comment

by:faster
ID: 1830390
print "Content-type: text/html\r\n\r\n";

read html file and write the whole file to stdout


0
 
LVL 84

Expert Comment

by:ozo
ID: 1830391
Or, to force the browser to reference it

print "Location: http://some.machine/some.directory/some.doc\r\n\r\n";
0
 

Author Comment

by:barlav
ID: 1830392
I don't want to write a file out to stdout when it's already in existence. I want to force the browser to reference it. ozo's comment is close to the answer that I'm looking for but it doesn't work. I tried your answer ozo but it just creates a webpage that displays literally  "Location: http://some.machine/some.directory/some.doc\r\n\r\n" and not the html document that resides there.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:barlav
ID: 1830393
ozo,
  Your answer worked when I didn't set the MIME type ahead of time. Since you headed me in the right direction I'll be happy to award you the points if you submit your comment as an answer.
0
 

Expert Comment

by:chuckie_worm
ID: 1830394
That is one way of doing this, alternatively you could try the following.

  print "Content-type: text/html\n\n";              # HTTP header
  print "<SCRIPT LANGUAGE=\"JavaScript\">\n";
  print "window.location.replace = '**URL**'\n";
  print "</SCRIPT>\n";

where **URL** is the URL of the page that you want to display.

Chuckie
0
 

Author Comment

by:barlav
ID: 1830395
It seems that the way I'm doing it now is much easier. Thanks for your answer chuckie_worm but I think it's only fair that I give the points to ozo since he put me in the right direction.
0
 
LVL 84

Accepted Solution

by:
ozo earned 100 total points
ID: 1830396
Location: http://some.machine/some.directory/some.doc

  or
Refresh: 0; URL=http://some.machine/some.directory/some.doc
Content-type: text/html

  or
Content-type: text/html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><meta http-equiv="refresh" content="0; url=http://some.machine/some.directory/some.doc">
</HEAD><BODY></BODY></HTML>
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

785 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