迁移到边缘浏览器 - 文件上传不起作用
我们从IE 8到Edge浏览器迁移,
以下是IE 8中使用的代码,以加载一个文件,但不在边缘。
if(window.ActiveXObject){
var fso = new ActiveXObject("Scripting.FileSystemObject");
var filepath = document.getElementById('filePath').value;
var thefile = fso.getFile(filepath);
您能否让我知道边缘浏览器的等效代码。
We are migrating from IE 8 to Edge browser,
Below is the code working in IE 8, to load one file, but not in Edge.
if(window.ActiveXObject){
var fso = new ActiveXObject("Scripting.FileSystemObject");
var filepath = document.getElementById('filePath').value;
var thefile = fso.getFile(filepath);
Could you please let me know equivalent code for edge browser.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Edge不支持ActiveX。您可以使用文件api
< input type =“ file”>
选择文件,然后使用 xmlhtttprequest 以在现代浏览器中上传文件。有关更多信息,您可以参考线程 and 此代码样本。
Edge doesn't support ActiveX. You can use File API
<input type="file">
to choose files and then use XMLHttpRequest to upload files in modern browsers.For more information you can refer to this thread and this code sample.
自您要升级的代码创建以来,发生了很多变化。现在存在本地存储并下载文件; (用例可能需要将其保存以在本地使用))添加了下载属性。该文件需要将
其迁移到local-nestorage或indexedDB API中。
ActiveX的替换没有下降。由于安全问题。
ActiveX的主要差异
允许JavaScript访问文件读取或写入的文件,包括能够在硬盘驱动器上的任何地方覆盖自己。
HTML5允许阅读和写入localdata和几个API,以获取包括indexDB在内的数据。但是,文件访问仅限于用户专门上传或下载到下载目录中的内容。
如果您希望自己覆盖本身,则不再可以替代自身的JavaScript Wiki页面。使用indexDB可以使用JavaScript Wiki页面。下载内容是可能的,但出于安全原因而有限。
A lot has changed since the code you are trying to upgrade was created. Local Storage now exists and to download a file; (Use case somebody may need to save it for using it locally) a download attrib is added to the anchor html tag. The file needs to be made into a URL-Blob
I would migrate to local-storage or IndexedDB API.
There is no drop in replacement for the activeX. because of security issues.
Major Differences
ActiveX allowed javascript to access a file to read or write, including being able to overwrite itself, anywhere on the hard drive.
HTML5 Allows reading and writting to localdata and several API for data including IndexDB. But file access is limited to what the user specifically uploads or for downloading into the download directory.
A Javascript WIKI page that replaces itself is no longer possible if you want it to overwrite itself. A Javascript WIKI page is possible using the IndexDB. Downloading the content is possible but limited for security reasons.