Internet Explorer 11 不接受模态 speedbump 中的变量

Internet Explorer 11 won't accept variables in modal speedbump

我正在使用 Kylefox 的 Jquery-Modal 库在网站上单击外部 link 时基本上具有 'speedbumps' 的网站。问题是 'speedbump' 模态仅编码一次,但我需要根据用户点击的外部 link 换出外部 link。这适用于除 IE11

以外的所有浏览器

我已经尝试了 Kylefox github 中概述的方法, 我什至在 modal.BEFORE_OPEN 操作中放置了 console.log 和警报,它似乎在 IE11 中根本没有触发。

$('#externallink').on($.modal.BEFORE_OPEN, function(event, modal) {
    var url = modal.$anchor.attr('data-href');
    $('#externallink #enterance').attr('href',url);
}); 

IE11 没有看到任何类型的事件,控制台没有显示 activity,这很奇怪,因为模态正在打开,但外部 link 没有填充在 speedbump 模态中。

我尝试使用 IE 11 (11.471.17134.0) 版本测试您的示例代码,发现您的代码在 IE 11 上运行良好,与在任何其他版本上运行一样浏览器。

我也尝试打印 HREF enterance 的值并且打印正确。

测试代码:

<!DOCTYPE html>
<html>
<head>
 <title>Page Title</title>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.2/jquery.modal.min.js"></script>
 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css">
</head>
<body>
<a href="#externallink" data-href="http://www.google.com" rel="modal:open">External Link 1</a><br />

<a href="#externallink" data-href="http://www.duckduckgo.com" rel="modal:open">External Link 2</a><br />

<div class="alertbox modal" id="externallink">Warning, this is an external link. Please press ok to continue<br />
<a href="" id="enterance" target="_blank" class="cta">Ok</a>  
<a href="#close" id="cancel" rel="modal:close">Cancel</a></div>

<script>
 $(document).ready(function(){
 $('#externallink').on($.modal.BEFORE_OPEN, function(event, modal) {
    var url = modal.$anchor.attr('data-href');
    $('#enterance').attr('href',url);
console.log("HREF = " + $('#enterance').attr('href'));
}); 
});  
 </script>
</body>
</html>

在 IE 11 中的输出:

我建议你使用我测试过的例子,并尝试在 IE 11 中直接 运行 来检查它是否工作。