2012-01-17 32 views
2

發送的網頁我有一個網頁,上載,顯示「微調」 GIF,同時它檢索使用jQuery的load()方法的內容。JQuery的負載()可以不通過電子郵件在IE

的Internet Explorer用戶的問題是當使用IE的內置「通過電子郵件發送\頁面」他們不能看到郵件的內容,很可能是因爲內容加載到一個div。

有沒有人有辦法解決這個問題?我應該使用不同的方法嗎?

這是代碼。

<script type="text/javascript"> 
$().ready(function() { 
    $('#result').load("/reports/default.do?method=report123", function(responseText, textStatus, XMLHttpRequest) { 
      if (textStatus == "success") { 
       $('#loading').hide(); 
       $('#result').show(); 
      } 
      if (textStatus == "error") { 
       alert("page could not be loaded."); 
      } 
     }); 
    }); 
    </script> 

    <div id="loading"><img src="../images/ajax-loader.gif" alt="loading" id="loading"/></div> 

    <div id="result"></div> 
+0

與問題無關,但'$().ready'已折舊並且不適用於較新版本的jQuery。它應該是'$(文件).ready' –

+0

...或只是'$(函數($){...});' – Pointy

回答

1

大多數(如果不是全部的話)電子郵件客戶端,包括Gmail,Hotmail等從電子郵件內容中刪除JavaScript。

這是爲了防止人們發送,可以包含可能攻擊的電子郵件。

頁功能,就如同你用JavaScript認爲它同樣在瀏覽器關閉。

任何原因,你需要通過Ajax負荷加載的內容,而不是隻包括它通過服務器端代碼的頁面?

編輯:

對於電子郵件收件人(和非JS用戶),你可以嘗試:

<noscript><a href="/reports/default.do?method=report123" title="report123">View the report.</a></noscript> 

放,現有的負載DIV中,改變加載圖像只頁面上展示負載:

<script type="text/javascript"> 
    $(function() { 
     $('#loading').show(); 
     $('#result').load("/reports/default.do?method=report123", function(responseText, textStatus, XMLHttpRequest) { 
     if (textStatus == "success") { 
      $('#loading').hide(); 
      $('#result').show(); 
     } 
     if (textStatus == "error") { 
      alert("page could not be loaded."); 
     } 
    }); 
}); 
</script> 

<div id="loading"> 
    <noscript><a href="/reports/default.do?method=report123" title="report123">View the report.</a></noscript> 
    <img src="../images/ajax-loader.gif" alt="loading" id="loading" style="display:none;"/></div> 

<div id="result"></div> 
+0

我們願意這樣做一個「加載」圖像將顯示在數據負載,否則用戶將顯示一個空白頁面,直到最終獲取結果。 – MLongman

+0

我想那個內容需要一段時間才能處理呢? – gscragg

+0

是的,不幸的。 – MLongman