即尝试打开本地文件时拒绝访问8.0 [英] Ie 8.0 Access Denied When Trying To Open Local Files

查看:77
本文介绍了即尝试打开本地文件时拒绝访问8.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此脚本适用于IE 6但不适用于IE 8.0
我的用户现在收到拒绝访问错误。我引用了哪些设置来启用
本地文件访问,以便此脚本可以正常工作?

This script works in IE 6 but not in IE 8.0 My users now get an "Access Denied error". What settings do I refer my users to do enable local file access so that this script will work?

<script language="JavaScript">
function viewFile(selectedItem) {
 for (i=0; i<selectedItem.options.length; i++) {
  if ((selectedItem.options[i] != null) && (selectedItem.options[i].selected == true)) {
   window.open("file://"+selectedItem.options[i].text);
  }
 }
}
</script>

用户可以从本地驱动器中选择多个文件。该列表存储在一个文本框中,然后单击列表中的一个选定文件。

Users can select multiple files from local drive. The list is stored in a text box and then clicks on one selected file from the list.

示例:

selectedItem.options[i].text = C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg


推荐答案

你无法做到这一点因为IE8的安全模型比IE6严格得多。

You're not going to be able to do that "out of the box" anymore as IE8's security model is much stricter than IE6.

您的选择有限,但可以包括:

Your options are limited, but can include:


  1. 开发用于访问用户本地驱动器的闪存组件。

  1. developing a flash component to access the user's local drive.

将网站实现为HTA(html应用程序),以提升对用户文件系统的访问权限。

Implement the site as an HTA (html application) which gives promoted access to the user's file system.

让访问者通过将您的站点添加到可信域列表中来自定义其IE安全设置,然后让受信任的域访问该文件:/// protocol (我不确定哪个安全设置适用于此特定功能,或者甚至可用。)

Have the visitors customize their IE security settings by adding your site to the list of trusted domains and then give trusted domains access to the file:/// protocol (I'm not sure which security setting applies to this particular feature, or if one is even available.)

开发一个插件或bho对象(类似于flash组件,但用C ++或C#编写)

Develop a pluggin or bho object (similar to flash component, but written in C++ or C#)

创建IE上下文菜单 - http://msdn.microsoft.com/en-us/library/bb735853(v = vs.85).aspx 也将提升权限。

Create an IE Context Menu - http://msdn.microsoft.com/en-us/library/bb735853(v=vs.85).aspx which will also have elevated privileges.

作为附注c:\ path的正确文件方案应该看起来像这样:

As a side note proper file schemes for c:\ paths should look like this:

file:/// c:/documents%20and%20settings/file.jpg

注意文件之后的三个 / ,uri-转义空格,所有 \ 都切换为 /

这篇关于即尝试打开本地文件时拒绝访问8.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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