我有以下按钮:
<input type="button" disabled onClick=document.location.href="?hash=blabla" tabindex="-1" class="btn btn-transparent btn-xs cbut0" />
现在这个按钮已经被禁用,使用另一个脚本来在鼠标悬停事件上重新启用它,但是似乎用户仍然可以通过加载简单的外部JavaScript来编程地单击该按钮:
window.onload = setTimeout(function(){
$('input.btn.btn-transparent').click();
}, 10000);
有没有办法防止这种行为,确保按钮只能通过鼠标点击而不是脚本触发?
我在Disabled button still fires using ".click()"找到了一些线索,但在我的情况下无法实现。
document.location.href="?hash=blablah"
。 - Mike Cluck