# Read document in browser itself

**URL:** <https://www.ruby-forum.com/t/read-document-in-browser-itself/143876>\
**Category:** Ruby\
**Created:** [July 23, 2008, 1:32pm UTC](https://www.ruby-forum.com/t/read-document-in-browser-itself/143876 "2008-07-23T13:32:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sujith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@sujith](https://www.ruby-forum.com/u/sujith)\
**Post date:** [July 23, 2008, 1:32pm UTC](https://www.ruby-forum.com/t/read-document-in-browser-itself/143876/1 "2008-07-23T13:32:25Z")

</div>

Thorsten M. wrote:

> link\_to(“whatever”, “/docs/file.doc”)
> 
> if file.doc is in a folder named docs in the public folder
> 
> what exactly happens in the browser would depend on the users  
> settings.  
> most likely the browser would ask him to save it

it will download the file , but i dont want to download the file,  
i just want to read the file in browser itself

pls any body reply soon pls

---

<div class="post-metadata">

**Author:** ![sujith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@sujith](https://www.ruby-forum.com/u/sujith)\
**Post date:** [July 23, 2008, 4:14pm UTC](https://www.ruby-forum.com/t/read-document-in-browser-itself/143876/2 "2008-07-23T16:14:29Z")

</div>

On 23 Jul 2008, at 12:26, Sujith Gangaraju wrote:

> i just want to read the file in browser itself
> 
> pls any body reply soon pls

Well to display it in the browser you’re going to have to download it  
into the browser, at which point it becomes a JavaScript problem. Have  
you considered asking on any of the JavaScript mailing lists whether  
an appropriate in-browser renderer exists? Or alternately you could  
try the various Rails mailing lists as it’s possible someone else has  
run into the same problem.

Ellie

## Eleanor McHugh Games With Brains [http://slides.games-with-brains.net](http://slides.games-with-brains.net)

raise ArgumentError unless @reality.responds\_to? :reason

---

<div class="post-metadata">

**Author:** ![sujith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@sujith](https://www.ruby-forum.com/u/sujith)\
**Post date:** [July 23, 2008, 9:34pm UTC](https://www.ruby-forum.com/t/read-document-in-browser-itself/143876/3 "2008-07-23T21:34:27Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

On Jul 23, 2008, at 4:07 PM, Eleanor McHugh wrote:

> > it will download the file , but i dont want to download the file,

This has nothing to do with JavaScript, but with the disposition  
method. By default, files will be delivered as an attachment, what you  
want is called “inline”. AFAIK, this can be done via #send\_file.  
It would be best to ask that question on the Rails mailing list, not  
the pure Ruby one.

Regards,  
Florian G.

> * * *
> 
> raise ArgumentError unless @reality.responds\_to? :reason

Hehe, I like that one.

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkiHh4sACgkQJA/zY0IIRZaJvwCgp634HUFZkY6QJ+H7x3q6Fgva  
1ggAn3OzjIcQUeYyIRNh4r8x17bGp9/D  
=Wj7J  
-----END PGP SIGNATURE-----
