gpt4 book ai didi

javascript - window.clipboardData.getData ("Text") 在 IE8 中返回 0

转载 作者:数据小太阳 更新时间:2023-10-29 06:13:38 25 4
gpt4 key购买 nike

我正在尝试在文本区域上实现最大长度。在 IE7 中,window.clipboardData.getData("Text") 返回正确的复制字符数。在 IE8 中,相同的调用返回 0。有什么问题吗?

这是js

var someRule= {
"textarea" : function(element) {
element.onpaste = function() {
var copied = window.clipboardData.getData("Text");
alert('copied length = '+copied.length);
}
}
};

Behaviour.register(someRule);

alt text

最佳答案

IE8 中有一个安全设置:

要阻止网站读取您的剪贴板,请执行以下步骤:

转到“工具”->“Internet 选项”。单击“安全”选项卡。单击“自定义级别”。向下滚动到设置下的脚本部分。将“允许通过脚本进行粘贴操作”设置为禁用或提示。按确定按钮关闭对话框。

在您的情况下,此设置可能已禁用。

关于javascript - window.clipboardData.getData ("Text") 在 IE8 中返回 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4328735/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com