簡體   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