gpt4 book ai didi

javascript - 如何在 IE 中自动允许被阻止的内容?

转载 作者:IT王子 更新时间:2023-10-29 03:00:39 26 4
gpt4 key购买 nike

我正在使用以下代码作为示例菜单。

    <html>
<head>
<title>Tree Demo</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.jstree.js"></script>
<script type="text/javascript">
$(document).ready(function() {
/* $("#main").jstree({
"themes" : {
"theme" : "default",
"dots" : false,
"icons" : false
},
"plugins" : [ "themes", "json_data", "ui"],
"json_data" : {
"ajax" : {
"url" : "jsondata.json",
"data" : function (n) {
return { id : n.attr ? n.attr("id") : 0 };
}
}
}
});

$("#main").bind("open_node.jstree", function (e, data) {
// data.inst is the instance which triggered this event
console.log(data);
console.log($.data(data.rslt.obj[0],"folder_name"));
});
$("#main").bind("select_node.jstree", function (e, data) {
// data.inst is the instance which triggered this event
console.log(data);
console.log($.data(data.rslt.obj[0],"folder_name"));
}); */

$("#main1").jstree({
"themes" : {
"theme" : "default",
"dots" : false,
"icons" : false
},
"plugins" : [ "themes", "html_data"]
});

});
</script>
</head>
<body>
<div id="main1">
<ul>
<li><a href="javascript:void(0)">Home Folder</a>
<ul>
<li><a href="javascript:void(0)">Sub Folder1</a></li>
<li><a href="javascript:void(0)">Sub Folder2</a></li>
</ul></li>
<li><a href="javascript:void(0)">Shared Folders</a>
<ul>
<li><a href="javascript:void(0)">Shared Folder1</a></li>
<li><a href="javascript:void(0)">Shared Folder2</a></li>
</ul></li>
</ul>
</div>
<div id="main">
</div>
</body>
</html>

当我在 IE 浏览器中运行上面的代码时,它显示在页面顶部(在 URL 栏下方)

“为了帮助保护您的安全,Internet Explorer 已限制此网页运行可以访问您的计算机的脚本或 Activex 控件。单击以查看选项..”

当我右键单击并单击允许阻止的内容时,它会运行。但我希望没有此弹出消息我需要运行代码...我如何自动运行此代码?...

最佳答案

也有一个代码解决方案。我在培训视频中看到了它。您可以添加一行来告诉 IE 本地文件是安全的。我在 IE8 上测试过,它可以工作。该行是 <!-- saved from url=(0014)about:internet -->

更多详情请引用https://msdn.microsoft.com/en-us/library/ms537628(v=vs.85).aspx

<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html lang="en">
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function () {
alert('hi');

});
</script>
</head>
<body>
</body>
</html>

关于javascript - 如何在 IE 中自动允许被阻止的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7038724/

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