如何配置 IE7 下载文件类型而不是在浏览器中打开

发布于 2024-07-06 02:17:59 字数 281 浏览 7 评论 0原文

我写了一个下载文件的 watir 脚本。 它下载的文件之一具有 .dcf 扩展名。 几个月前,我在我的计算机上更改了某处的设置,以便提示下载 .dcf 文件(“您要打开还是保存此文件吗?”),而不是在浏览器中打开。 这就是我想要的行为。 我使用的是 XP Pro/IE7。

我现在正在设置一台专用的测试机器,但似乎找不到我在我的机器上所做的配置选项 - 这很容易找到,以至于我没有注意到它。 我现在找到的所有解决方案都是关于更改下载本身或修改注册表。 我正在从浏览器/IE 级别的客户端角度寻找一些东西。

I have written a watir script that downloads files. One of the files it downloads has a .dcf extension. Months ago, on my machine, I changed a setting somewhere so that .dcf files prompt for download ("Do you want to open or save this file?") instead of opening in the browser. This is the behavior that I desire. I am using XP Pro/IE7.

I'm now setting up a dedicated test machine, but cannot seem to find the configuration option that I did on my machine - which was so easy to find that I didn't make note of it. All of the solutions that I am finding now are either about changing the download itself or modifying the registry. I am looking for something from the client perspective at the browser/IE level.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

温暖的光 2024-07-13 02:17:59

tloach 的链接提供了我需要的答案的方向:

  1. 我需要打开一个 Windows 资源管理器窗口并从工具菜单中选择文件夹选项...
  2. 我需要转到文件类型选项卡并找到我想要更改其行为的扩展名。
  3. 我需要文件类型的高级按钮 - 它并不总是存在。
  4. 下载后确认打开复选框需要选中(未清除)
  5. 需要有操作 - 并不总是如此。 我发现一个名为edit的函数和另一个名为open的函数就足够了。 我将它们绑定到记事本(C:\WINDOWS\system32\NOTEPAD.EXE %1)。 我还需要选中使用 DDE 复选框并为应用程序:填写NOTEPAD > 和主题系统

希望这对其他人有帮助。 下次可能会对我有帮助。

tloach's link provided direction towards the answer I needed:

  1. I needed to open a windows explorer window and select Folder Options... from the Tools menu.
  2. I needed to go to the File Types tab and locate the extension for which I wanted to change behavior.
  3. I needed to have the Advanced button for the file type - it isn't always there.
  4. The Confirm open after download checkbox needs to be checked (not cleared)
  5. There need to be Actions - there aren't always. I found that one called edit and another called open were enough. I tied them to notepad (C:\WINDOWS\system32\NOTEPAD.EXE %1). I also needed to check the Use DDE checkbox and fill in NOTEPAD for Application: and System for Topic:

Hopefully this will help others. It will likely help me the next time.

他不在意 2024-07-13 02:17:59

对于 PHP,请尝试使用以下标头:

header("Content-Type: application/force-download");

标头(“内容类型:应用程序/八位字节流”);

header("内容类型:应用程序/下载");

header("内容处置:附件;filename=".basename($filename).";");

当然,无论您使用什么语言,您都可以使用相同的标头。

For PHP, try using these headers:

header("Content-Type: application/force-download");

header("Content-Type: application/octet-stream");

header("Content-Type: application/download");

header("Content-Disposition: attachment; filename=".basename($filename).";");

Naturally you can make use of the same headers in whatever language you are using.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文