Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-22-2007, 12:50 PM   PM User | #1
c q
Regular Coder

 
Join Date: Jun 2002
Location: Mumbai, India
Posts: 173
Thanks: 0
Thanked 0 Times in 0 Posts
c q is an unknown quantity at this point
Prevent the Save As... dialog when linking to files

Hi!

I'm trying to solve this nagging problem for a while now.. but haven't succeeded yet.

I have an e library database implemented, where teachers can upload their resources (could be ppt, pdf, doc whatever...)

they can then use each others' resources in their elearning courses by adding a link.

I noticed that everytime i try to link something in a course, clicking them throws up a "save as" dialog. Whether i link them, add them in a frame, iframe or a separate popup window altogether.

I want to force the files to open in the browser window itself. How can I make it happen?

thanks in advance.
c q.
__________________
It's a new world. It's a new day.
www.nehasaxena.com : : www.kohimaorphanage.org
c q is offline   Reply With Quote
Old 05-22-2007, 03:28 PM   PM User | #2
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
The dialog box is a function of the PC itself. With Windows, you can
tell the browser to "open as" any particular filetype without a dialog box.
You don't really have control over that with your website.

On my PC with Firefox, when I click on a PDF link, it opens it right up with
Acrobat Reader in it's own window, same with .doc type .. only because I
set-up the "open with" filetypes that define which program opens which links.

There are ways to output .doc and .pdf (and other types) directly into the
browser using some server-side scripts. Things like PDF to HTML on-the-fly.
This involves having your own server with the PHP or Perl modules installed.

This type of thing is very similar to PHP GD library which can alter .jpeg
images (resize, crop, watermark, etc) on-the-fly before serving them to
the visitor's browser ... instead, it does the same thing with various text
types.
mlseim is offline   Reply With Quote
Old 05-22-2007, 09:01 PM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,451
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Whether a SaveAs displays depends on two things.

1. Is the file being delivered to the browser with a disposition of inline or attachment. If attachment then the SaveAs will always display.
2. For disposition inline, it then depends on whether the browser knows how to display it. If it can display the file it will, if it can't it will offer SaveAs.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 05-23-2007, 07:46 AM   PM User | #4
c q
Regular Coder

 
Join Date: Jun 2002
Location: Mumbai, India
Posts: 173
Thanks: 0
Thanked 0 Times in 0 Posts
c q is an unknown quantity at this point
Well I am running it in my own WAMP server.

How do i configure the headers so that the browser loads the document inline no matter what the client browser setting? Also, if the user does not have the right application (say acrobat for pdfs...) I would like some script to prevent the save as dialog box.

any pointers, friends?
__________________
It's a new world. It's a new day.
www.nehasaxena.com : : www.kohimaorphanage.org
c q is offline   Reply With Quote
Old 05-23-2007, 11:29 AM   PM User | #5
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,451
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
If the browser doesn't have a plugin to handle a particular file type then it can't display that file in the browser regardless. You can force a file to be offered for download by setting the Content-disposition to attachment but you can't force it to load in a browser if the browser or browser owner doesn't want it to.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 05-23-2007, 11:35 AM   PM User | #6
Pennimus
Senior Coder

 
Join Date: Jul 2005
Location: UK
Posts: 1,051
Thanks: 6
Thanked 13 Times in 13 Posts
Pennimus is on a distinguished road
You may be interested to know that PDF and DOC files are not suitable for online reading due to being bad for usability and accessibility.

My advice would be to always force a download for this type of content, and to provide it in HTML for online use as well.

See http://www.useit.com/alertbox/20030714.html for more info <-- this equally applies to other non standard document formats as well.
Pennimus is offline   Reply With Quote
Old 05-23-2007, 12:17 PM   PM User | #7
c q
Regular Coder

 
Join Date: Jun 2002
Location: Mumbai, India
Posts: 173
Thanks: 0
Thanked 0 Times in 0 Posts
c q is an unknown quantity at this point
i don't like pdfs either, but unfortunately, I have to use this file format because my bosses seem to love it. I am already facing problems with slideshows not behaving the same in different computers due to different acrobat reader versions. But i have to work around it but i cannot abandon pdf.

What they essentially want is that the documents should only be readable on screen. No printing options, no save as options. Ofcourse, i could argue that one can still take screenshots and print, or recover the file from their temp folders... but we're talking about fairly non techie bank operations staff here. It would be enough if they are not given any save as options upfront in the website. They would not try too hard to recover them.

One answer is a rights management server... but its an expensive affair.

The other solution is to password protect the file. My elearning portal can pass variables into the files, so only legitimate open requests which are routed through the elearning server can open the file. Even if they save the file and go home, they'd need a password to open it. Now again, they would not be so desperate as to get a password crack.

But this is a slightly wrong forum to ask this in... still.... does anyone know what variable name is this password field known as in a pdf? :-/
__________________
It's a new world. It's a new day.
www.nehasaxena.com : : www.kohimaorphanage.org
c q is offline   Reply With Quote
Old 05-23-2007, 04:23 PM   PM User | #8
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
I would say that you would be looking into something other than an
internet browser. Like a dedicated program in C++ or VBasic that
is similar to a kiosk. This could then turn-off any screen saving, printing,
keyboard functions, etc ... making the mouse the only input device.

Some sort of software like that could access the files from the internet,
yet have total control over the viewer, unlike a browser.

You should look into some Kiosk type software.
mlseim is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 02:01 PM.


Advertisement
Log in to turn off these ads.