ActiveXObject(“ADSystemInfo”) 上的错误
我的 JavaScript 上有这一行当
var objSysInfo=new ActiveXObject("ADSystemInfo");
var objUser=GetObject("LDAP://" + objSysInfo.UserName);
alert(objUser.displayName);
我以管理员身份登录时,一切正常,但如果我以非管理员帐户登录,它就会开始给出异常,说明
var objSysInfo=new ActiveXObject("ADSystemInfo");
这里似乎存在问题,我将如何解决它? 有没有其他方法可以从 javascript 获取用户信息,我只想获取显示名称? (我知道这在 FF 和 Chrome 上不起作用)
顺便说一句,这是我得到的错误“自动化服务器无法创建对象活动 x”
I have this line on my JavaScript
var objSysInfo=new ActiveXObject("ADSystemInfo");
var objUser=GetObject("LDAP://" + objSysInfo.UserName);
alert(objUser.displayName);
When I am logged in as an admin everything works fine, but if I am logged in as a non-admin account it starts to give exception on
var objSysInfo=new ActiveXObject("ADSystemInfo");
what seems to be the problem here and how will I solve it?
Are there any other alternatives to get the User Info from javascript, I just want to get the display name? (I know this wont work on FF and Chrome)
BTW this is the error I Get "automation server can't create object active x"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该错误表明当前用户的浏览器安全设置可能不允许该特定 ActiveX 控件的实例化。除非您可以更改用户的浏览器安全设置,否则您实际上无法以编程方式(使用 JavaScript)对此进行任何操作。
您不会收到与管理员用户相同的错误,可能是因为安全设置更宽松。
尝试使用“Internet 选项”中的 ActiveX 安全设置,看看是否可以使其与非管理员用户一起使用。也许最终用户的解决方案是提供有关如何更改 ActiveX 安全设置的文档。
The error indicates that the browser security settings of the current user probably don't permit the instantiation of that particular ActiveX control. Unless you can change the browser security settings of the user, there's really nothing you can do about it programmatically (using JavaScript).
You don't get the same error as an admin user probably because of more lax security settings.
Try playing around with the ActiveX security settings in Internet Options and see if you can get it to work with the non-admin user. Maybe the solution for your end users is to provide documentation on how to change the ActiveX security settings.
我知道这个问题几年前就被问过。但是,我回答是为了以防万一有人可能需要此信息:
您可能想使用更像这样的东西:
也许这对您有用?
I know that this question was asked a few years ago. However, i am answering just in case someone might need this information:
You might want to use something more like this:
Maybe that'll work for you??