Quantcast
Channel: 黑暗執行緒
Viewing all articles
Browse latest Browse all 2311

SSRS報表瀏覽器相容議題

$
0
0

接獲報案,某使用HTML5技術的網頁以iframe內嵌SSRS報表,若以IE9開啟該網頁,報表排版走樣,但使用IE10開啟則正常。單獨開啟SSRS報表(URL /reportserver/viewer/..)測試,發現不同IE相容性檢視結果均不同,只有用IE5(Quirks)檢視正常,而IE7/8/9/10相容模式壞掉的地方都不相同。


IE5正常(IE9-遇到網頁未指定<!DOCTYPE>的預設模式)

IE7模式,報表寬度OK,下半部被截斷。

IE8模式,報表只出現一小塊,右邊出現雙下巴捲軸

IE9,報表只出現一小塊

IE10,報表變瘦又變高,變成姚明來著

由結果推測SSRS2005報表只支援Quirk模式,測試機版本為SQL 2005 SP3,本想升級SP4試試手氣,但在stackoverflow被澆一盆冷水:

I can tell you, I have 3 years experience with the damn thing (SSRS 2005, SSRS 2008 R1 & R2, and SSRS 2012).
Let me assure you that because SSRS HTML reports depend on IE5-Quirksmode, there is no chance in hell they will ever render correctly in any browser other than Internet Explorer (IE < 10 I might be inclined to add).

依據曾跟SSRS2005-2012博鬥多年苦主的證言,SSRS只適用IE並限定IE5 Quirks模式!就算升級也沒效,至於為什麼HTML5網頁以IFrame內嵌SSRS報表,用IE10檢視OK,用IE9卻不行?MSDN有答案

As of IE9 mode, webpages cannot display multiple document modes. For example, consider a standards-based webpage that contains a frame element that displays content in quirks mode. IE9 mode displays the child frame in standards mode (because the parent document is in standards mode). Starting with Internet Explorer 10, however, child frames can emulate quirks mode. For more info, see IEBlog: HTML5 Quirks mode in IE10. For best results, however, use document modes consistently.

在IE9(含)之前,網頁不能混合多種文件模式。IE10起,才允許網頁走標準模式,子Frame模擬Quirk模式,正是HTML5網頁內嵌SSRS報表的情境。

不打算深究搞Hacking,我想到幾種解決方式:

  1. 請使用者升級IE10
  2. 將報表改為RDLC,改用ReportViewer(瀏覽器支援度較廣
  3. 放棄HTML5,改成傳統Quirks網頁(走回頭路,不推)
  4. 用window.open取代iframe克服IE9不支援混用文件模式限制(彈出視窗很可能被瀏覽器封鎖,部署狀況較多)

個人投RDLC一票。


Viewing all articles
Browse latest Browse all 2311

Trending Articles