小编典典

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

html

我使用下面的代码作为示例菜单。

    <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控件,这些脚本或Activex控件可以访问您的计算机。单击查看选项。”

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


阅读 519

收藏
2020-05-10

共1个答案

小编典典

我相信这只会在这种特殊情况下在本地运行页面时才会出现,即从Web服务器加载apge时您不会看到此信息。

但是, 如果 您有这样做的权限,则可以按照 工具 (菜单)→ Internet选项安全性 (选项卡)→ 自定义级别
(按钮)→和 禁用 对ActiveX控件的自动提示来 关闭Internet Explorer的 提示

当然,这只会影响您的浏览器。

2020-05-10