链接到Web应用程序中的本地内容 [英] Linking to local content in a web application

查看:112
本文介绍了链接到Web应用程序中的本地内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理遗留应用程序的替换应用程序。由于遗留应用程序的某些设计限制,附件在我们的数据库中存储为String路径(通常是存储在Windows共享驱动器上的文件)。然后,遗留应用程序可以通过打开Windows命令shell并执行给定路径来打开附件。

I am working on a replacement application to a legacy application. Due to certain design limitations of the legacy application, 'attachments' are stored as a String path in our database (generally files stored on a windows shared drive). The legacy application can then 'open' the attachments by opening a windows command shell and executing the given path.

旧版(Oracle Forms)应用程序正在逐步淘汰基于JSF的J2EE Web应用程序。新应用程序需要能够以某种方式打开或链接到这些传统附件。这有可能吗?我试图使用file:// URL,但使用它们有很多警告。它们只能在IE中的远程主机上工作,firefox / chrome(以及我认为的其他现代浏览器)会阻止本地文件URL。

The legacy (Oracle Forms) application is being phased out by a JSF based J2EE web application. The new application needs to be able to 'open' or link to these legacy attachments somehow. Is this even possible? I have attempted to use file:// URLs, but there are lot of caveats with using them. They only work on remote hosts in IE, firefox/chrome (and other modern browser I assume) prevent local file URLs.

只能在IE上工作才能适应这一特定功能。我进一步遇到了带空格的文件路径问题。出于某种原因,如果IE遇到包含空格的文件路径,请说

Working only on IE is something that can be lived with for this particular feature. I further ran into an issue with file paths with spaces. For some reason if IE encounters a filepath with spaces in it, say

C:\Documents and Settings\user123\My Documents\testing\someFile.txt

它拒绝打开该链接。浏览器会自动将空格('')替换为其编码'%20'的URL。

it refuses to open that link. The browser automatically replaces the spaces (' ') with its URL Encoded '%20'.

我尝试的相关链接如下:

The associated link I am attempting looks like:

<a href="file:///C:\Documents and Settings\user123\My Documents\testing\someFile.txt">link</a>

我有什么简单的东西吗?或者有更简单的方法吗?

Is there something simple to this I am missing? Or is there any easier way of doing this?

我不太清楚要标记什么,所以可以根据需要随意重拍。

I wasn't quite sure what to tag this as so feel free to retag as necessary.

推荐答案

经过一些广泛的测试后,我得出以下结论:

After some extensive testing I have reached the following conclusions:


  • 只有IE会打开远程主机页面上的file://链接,其他浏览器会直接阻止它们,当用户点击它们时不会发生任何事情。

  • IE将只打开file://指向驻留在网络驱动器上的文件的URL

    • 如果用户单击指向文件的文件://链接用户的本地驱动器,什么都不会发生,他们不会收到任何错误。

    希望如此这有助于其他人在寻找文件网址上的信息。

    Hopefully this helps someone else out who's looking for information on file urls.

    这篇关于链接到Web应用程序中的本地内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆