繁体   English   中英

IE浏览器中打开新窗口时出现问题

[英]issue in IE browser while opening a new window

我有这小段代码

$("a").live("click",function(event) {
                    <% String lifeCare=LifeEventProperties.getInstance().getProperty("lifeCare");%>
                    var s="<%=lifeCare%>"; 
                    var href = $(this).attr('href');
                    if (href.indexOf(s) != -1) {
                        loadLifeCare(href) ;
                        event.preventDefault();
                    } 
                });

function loadLifeCare(href)
    {
        var wnd=window.open('/NASApp/benemain/LifeCareSite');
        setTimeout(function() {
            wnd.location.href = href;
        }, 6000);
    }

在我的jsp页面中,我已经使用jquery检查了url中的特定单词,并且该单词就像我从属性文件中获取的“ something.com”,现在是否在用户单击的url中找到了something.com然后我调用了一个javascript函数,然后使用内部站点url打开一个新窗口,该窗口负责处理该用户具有该something.com的页面的会话,然后用用户实际单击的“ href”重载该页面。

问题是它在所有浏览器的其他IE中都能正常工作,并且我的客户喜欢IE,IE直接转到链接,绕过loadLifeCare方法,并在控制台上给我这个错误

The value of the property 'loadLifeCare' is null or undefined, not a Function object 

有什么可以暗示为什么发生的吗?这段代码中有IE无法理解的东西吗,我感觉到window.open()可能有问题,但是我不确定,我什至都不知道如果是这样的话。

请帮助我,告诉我是否需要任何澄清。

尝试这个

  1. 修复过时的live
  2. 使用了更好的方法来打开窗口(您很可能会拒绝访问;
  3. 在使用该函数之前将其移动到,并将click事件处理程序包装在一个加载处理程序中

function loadLifeCare(href) {
  var wnd=window.open('/NASApp/benemain/LifeCareSite',"lifeCareWin");
  if (wnd) setTimeout(function() {
    window.open(href,"lifeCareWin");
  }, 6000);
}

$(function() {
  $("a").on("click",function(event) {
    <% String lifeCare=LifeEventProperties.getInstance().getProperty("lifeCare");%>
    var s="<%=lifeCare%>"; 
    var href = $(this).attr("href"); // this.href might be useful too
    if (href.indexOf(s) != -1) {
      loadLifeCare(href) ;
      event.preventDefault();
    } 
  });
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM