?
Solved

Loading an existing html file into a browser

Posted on 1998-07-01
7
Medium Priority
?
152 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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 400 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

765 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