本文介绍了使用Internet Explorer 8的prompt()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难找到问题的解决方案。这是一段代码片段:

I am having a hard time figuring out a solution for my problem. Here's a code snippet:

var ans = prompt("Mot de passe", '');
if (ans != '' && ans != null)
   __doPostBack('__Page', ans);
else
   window.location = "../Erreurs/NotAuthorized.aspx";

此代码在Internet Explorer 9中运行得非常好。但我的客户端专门使用Internet Explorer 8我在IE8中使用ieTester进行了测试。但问题是提示不显示并且它会自动重定向,因为输入有一个空字符串('')。

This code works really great with Internet Explorer 9. But my client is exclusively working with Internet Explorer 8 so I tested it with ieTester in IE8. But the problem is that the prompt doesn't show and it automatically redirect because the input had an empty string ('').

所以如何修复此问题以使用Internet Explorer 8?

So how do I fix this to work with Internet Explorer 8?

推荐答案

它看起来像IE-8特定的安全事项,我没有其他版本可供测试。调用 prompt()会产生有关要求提供信息的脚本窗口的警告。我可以单击以允许并在刷新页面后,提示框按预期显示。

It looks like a security thing specific to IE- 8 for sure, I don't have other versions to test. Calling prompt() produces a warning about a scripted window asking for information. I can click to allow and after refreshing the page, the prompt box appears as expected.

如果您要坚持使用 prompt() ,您可能必须规定目标计算机上的安全设置已配置为允许它。

If you are going to insist on using prompt(), you will probably have to stipulate that security settings on the target machines are configured to allow it.

这篇关于使用Internet Explorer 8的prompt()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 07:40