简体   繁体   English

仅打开文本文件时,如何防止IE显示“ Internet Explorer限制此网页运行脚本...”消息?

[英]How to prevent IE from showing “Internet Explorer restricted this webpage from running scripts …” message when opening just a text file?

In my software I need to open a plain text file for viewing only. 在我的软件中,我需要打开一个纯文本文件仅供查看。 I chose to use a default web browser to do that since it is most certainly available on any system. 我选择使用默认的Web浏览器来执行此操作,因为肯定可以在任何系统上使用它。 (Note that I can't use Notepad because of the " for viewing only " restriction.) (请注意,由于“ 仅供查看 ”的限制,我无法使用记事本。)

So to do that I do the following: 为此,我将执行以下操作:

ShellExecute(NULL, L"open", TextFilePath, NULL, NULL, SW_SHOWNORMAL);

This works great on all web browsers, except, ... (you guessed it) IE. 除...(您猜对了)IE之外,这在所有网络浏览器上都很好用。 That shows this message: 显示以下消息:

"Internet Explorer restricted this webpage from running scripts or ActiveX controls" “ Internet Explorer限制了此网页的运行脚本或ActiveX控件”

在此处输入图片说明

The text file obviously doesn't have any scripts or Active X controls. 该文本文件显然没有任何脚本或Active X控件。 It's just a .txt file! 这只是一个.txt文件! But understandably this message worries some users that think that my program tries to run something "bad" on their computer. 但是可以理解的是,此消息使一些认为我的程序试图在其计算机上运行“错误”程序的用户感到担忧。

So I'm curious, if there a way to prevent this dumb message without modifying any global IE settings? 所以我很好奇,是否可以在不修改任何全局IE设置的情况下防止这种愚蠢的消息?

Maybe you should execute the following steps: 也许您应该执行以下步骤:

  1. Go to internet options 转到互联网选项
  2. Tab "advanced" 标签“高级”
  3. Scroll down to Security 向下滚动到“安全性”
  4. Check mark "Allow active content to run in files on My Computer 选中标记“允许活动内容在我的电脑上的文件中运行

Hopefully this will work. 希望这会起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何防止在托管的Internet Explorer中打开新窗口 - How to prevent a new window from opening in hosted Internet Explorer 在XP上使用Windows文件资源管理器时,停止打开explorer.exe任务栏 - Stopping the explorer.exe taskbar from opening when using the windows file explorer on XP 从打开文件资源管理器中停止SetVolumeMountPoint - Stop SetVolumeMountPoint from opening file explorer Qt如何防止将项目从应用程序拖放到Windows File Explorer - Qt How to Prevent dropping item FROM application TO Windows File Explorer 从Internet Explorer与服务交互 - Interacting with a Service from Internet Explorer 在Windows中运行.exe文件时,如何防止ucrtbase.dll崩溃? - How to prevent crash from ucrtbase.dll when running .exe file in windows? 如何从Internet Explorer获取与Cookie关联的到期日期和标志? - How to get expiration date and flags associated with a cookie from Internet Explorer? 如何抑制来自 iframe 的 Internet Explorer 7 上的脚本错误? - How to suppress script errors on internet explorer 7 coming from an iframe? 从 Finder 打开文件时如何获取文件路径 - How to get file path when opening a file from Finder 从Qt中的超链接打开文本文件 - Opening a text file from Hyperlink in Qt
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM