HTA : “Safety Settings on this computer prohibit accessing a data source on another domain”

♀尐吖头ヾ 提交于 2019-12-10 19:08:15

问题


I am dealing with the same error message (as the subject) like two other threads: Suppress ADO Security Warning in JavaScript/HTM Page and How to create intranet website accessing database dynamically without server or server side scripts? but my application runs on the local computer only, it has nothing to do with any network or remote database.

The problem happens on some of my users' computer only. I have simplified the program to 1.js and 1.hta as listed below. Run 1.js through command line "cscript.exe 1.js" works fine on the users' computer (Windows 7). But run 1.hta on the same computer got the error "Safety Settings on this computer prohibit accessing a data source on another domain". 1.js and 1.hta are nearly the same!

The line that makes the problem is calling : ado.LoadFromFile("1.hta"); I have to use ADO instead of fso (Scripting.FileSystemObject), because fso can't access utf-8.

==== 1.js ===========

// run me through a DOS box command line : cscript.exe 1.js
var ado; 
ado = new ActiveXObject("ADODB.Stream");
var data;
ado.CharSet = "utf-8";
ado.Open();
ado.LoadFromFile("1.js");
data = ado.ReadText();
ado.Close();
WScript.echo(data);

==== 1.hta ==========

<HTML>
<HEAD>
<meta http-equiv="x-ua-compatible" content="ie=9">
<HTA:APPLICATION ID="Debug" 
   caption="yes" 
   maximizebutton="no" 
   minimizebutton="no" 
   sysmenu="yes" 
   BORDERSTYLE="complex"
   BORDER="thick"
/>
<TITLE>HTA - Debug</TITLE>
<script language="JScript">
var ado; 
ado = new ActiveXObject("ADODB.Stream");
var data;
ado.CharSet = "utf-8";
ado.Open();
ado.LoadFromFile("1.hta");
data = ado.ReadText();
ado.Close();
</script>
</HEAD>
<BODY>
<H2>HTA - Debug, try to read my own source code "1.hta"</H2>
<div id=sourcecode></div>
<script language="JScript"> sourcecode.innerText=data;</script>
</BODY>
</HTML>

1.hta works fine on all Windows7, windows 8, windows 10 computers I can find. To make sure someone who can help me would be able to 100% reproduce the problem, I have found that 1.hta always failed on Windows XP. That's the only way I can reproduce the problem. We have tried to change IE's security settings, it doesn't work for either fixed the computer in ill or push any healthy computer into illness. I believe HTA does not refer to IE's settings.

Why is this happening on some computers? Point me any hint would be very much appreciated.


回答1:


This worked well for me.

Modify the internet options in IE:

Go to Internet options -- Security Tab -- Select Internet and Local Intranet -- click Custom Level (button ) -- Miscellaneous -- select enable for Access data source across domains.

After that I reopened theQLIKVIEW model.

For me it worked..

Good Luck



来源:https://stackoverflow.com/questions/32177060/hta-safety-settings-on-this-computer-prohibit-accessing-a-data-source-on-anot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!