0

Possible Duplicate:
Firefox Links to local or network pages do not work

Hi all,

I would like to know how can i offer users that connected in my web site (in JAVA - JSP pages) to show the contents of files in THEIR PC over Web browser.

More precisely, i want to have a button, on what when user click, it open a new TAB or new window (of the browser) with path like : file:///home/user...

I did try with my flowing snippet of codes:

<script type="text/javascript">
[...]
   window.open("file:///home/user...");
[...]
</script>

this works fine when i open my html file manually with Firefox, but when i try to load it in a application server (Java EE), it doesn't work at all. I get this kind of message in my error console (of firefox):

Security Error: Content at http://localhost:8080/MyProject/test.jsp may not load 
or link to file:///home/user.

It seems to be a problem related to the security policies of Firefox, still i didn't found any issues to resolve my problem ...

Do you have any ideas about this?

Community
  • 1
  • 1
tunix2fr
  • 381
  • 3
  • 9

3 Answers3

1

It's impossible because of security reasons.

Pavel Strakhov
  • 39,123
  • 5
  • 88
  • 127
0

Remote pages are not allowed to link to file:// pages because it allows attacks on the browser, and in some cases on the OS. For example, <img src="file:///dev/tty"> on Linux will hang the browser for most users (the few running it from a terminal will be able to recover by foregrounding it, but that's it).

Boris Zbarsky
  • 34,758
  • 5
  • 52
  • 55
0

It's not possible to read a local file through your web application, however, you can ask the user to upload the file first and then open it.

CaoZ
  • 1