Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Sending default code back to browser

Reply
Thread Tools

Sending default code back to browser

 
 
Page
Guest
Posts: n/a
 
      12-12-2003
I'm not sure how this would work, but I'm guessing it's possible...

I have a Perl script that retrieves one of either two types of files, gifs
and pdfs. It works well. The URL specifices which gif or pdf is to be
returned. The script finds the file on the server, opens it, and sends it
to the user's browser window.

My problem is when the user specifies a file that doesn't exist. Because of
the nuances of Internet Explorer, if the user used a URL to view a PDF, the
next time that user uses that same url, a PDF is expected by IE to be
returned. If I try to return HTML text saying, "Sorry, file not found", IE
has trouble rendering it since it isn't a PDF this time. So what I'd like
to do is return a "default" PDF or GIF in the event that the file isn't
found. I don't want to create a default PDF or GIF file though. In other
words, I'd like to hardcode the GIF or PDF info in the Perl script.

Is this as easy as opening a PDF in a text editor, copying the code, and
pasting it into a Perl Print statement (making sure to send the appropriate
content headers of course)? When I open a GIF in a text editor, I get some
pretty weird looking Hex code, so I didn't know if this approach would work.
 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      12-12-2003
Page wrote:
> My problem is when the user specifies a file that doesn't exist.
> Because of the nuances of Internet Explorer, if the user used a URL
> to view a PDF, the next time that user uses that same url, a PDF is
> expected by IE to be returned. ...


Do you have a Perl question?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can we disable the browser 'Back' button using Javascript code or anything? Raj Java 8 04-19-2010 09:39 AM
After gmail logs out, cannot go back through browser back button Author ASP .Net 6 01-22-2009 03:24 PM
Internet Explorer Browser Extension: Switching from Live to Development and back again with a browser extension or BHO--how to create it? Danny Javascript 11 06-27-2007 01:50 PM
venkman and firebug loading source code for a page without sending the params that were sent when the browser made the call Eyal Javascript 0 11-08-2006 10:52 AM
pls help me when i sent mail, it vil sending twice instead of once ,am using java.mail,am sending my code.... shailajabtech@gmail.com Java 0 09-28-2006 06:38 AM



Advertisments