Large Table in iFrame crashes IE8
I have a page with an iFrame whose source is an ashx page. The handler takes in 3 arguments through the query string and generates a text/html response containing a table. When the table gets >1700 rows it crashes the IE8 browser. The browser freezes and returns a null reference error.
If I take the html that is being rendered and place it inside a DIV on the page it renders f开发者_如何学Goine in IE8. Any suggestions?
The crash is being caused by an IE8 feature called SmartScreen. It prevents users from navigating to known malware and phishing sites. It also as a unintended feature prevents websites from pulling down large amounts of data after rendering. Once this feature is turned off the crashes go away completely.
If I take the html that is being rendered and place it inside a DIV on the page it renders fine in IE8. Any suggestions?
Does the ashx handler render a complete html page or only the table fragment?
Make sure the page is valid html with html, body tags.
Also tables freeze the layout process in most browsers. Have you tried using div tags just to see if it crashs IE 8
[update] From your comments, I do not believe the problem is the large table. Therefore, this answer does not apply, but I will leave it because it seems this question arises numerous times on SO.
Try "compatibility view", same problem?
Try reducing the page's size. For instance,
- strip unnecessary white space, (do first because it is easiest)
- temporarilly use css rule names of two characters for rules you use many times,
- temporarilly use control names and control ids of two or three characters for controls you use in repeater-like controls, such as data-lists, grids, and so on.
Notes
Public Class SearchPage
Inherits System.Web.UI.Page
'NOTE
'short names for variables, controls, and so on, are specifically to reduce file size.
'used 69,106 records for
' testing/development (this will increase by 10,000 per month)
'limited to 10,000 records for production (customer rarely will have more than 10,000 and only a few will always have 10,000+)
Private Const DefaultResultLimit As Integer = 10000
Private Const CheckPoint As Integer = 100
Private Sub PopulateSearchResults(ByVal oResults As DataTable)
Dim iCount As Integer
For Each oRow As DataRow In oResults.Rows
AddTableRow(tblBOM, New BomInfo(oRow))
iCount += 1
If (iCount Mod CheckPoint) = 0 Then
If Not Me.Response.IsClientConnected Then
Exit For
End If
End If
If iCount > Me.ResultLimit Then
'limit results
Exit For
End If
Next
End Sub
Private Sub AddTableRow(ByVal table As Table, ByVal bom As BomInfo)
'NOTE
'short names for variables, controls, and so on, are specifically to reduce file size.
Dim oRow As New TableRow
oRow.CssClass = "btr"
oRow.Cells.Add(CreateCell(New HighlightControl(bom.ManufacturerName, _searchTerm, "sv"), "btc"))
oRow.Cells.Add(CreateCell(New HighlightControl(bom.Mpn, _searchTerm, "sv"), "btc"))
oRow.Cells.Add(CreateCell(New HighlightControl(bom.PartDescription, _searchTerm, "sv"), "btc"))
oRow.Cells.Add(CreateCell(New HighlightControl(bom.Markings, _searchTerm, "sv"), "btc"))
oRow.Cells.Add(CreateCell(bom.IcLength, "btc cntr"))
oRow.Cells.Add(CreateCell(bom.IcWidth, "btc cntr"))
oRow.Cells.Add(CreateCell(bom.PackageType, "btc cntr"))
oRow.Cells.Add(CreateCell(bom.PinCount, "btc cntr"))
oRow.Cells.Add(CreateCell(FormatCurrency(bom.ComponentPrice), "btch cr"))
oRow.Cells.Add(CreateCell(FormatCurrency(bom.ComponentTotal), "btc cr"))
oRow.Cells.Add(CreateCell(bom.Quantity, "btc cntr"))
oRow.Cells.Add(CreateCell(bom.ReleaseDate, "btc cr"))
oRow.Cells.Add(CreateCell(bom.ModelInfo, "btc"))
oRow.Cells.Add(CreateCell(bom.ComponentFunction, "btc"))
table.Rows.Add(oRow)
End Sub
'...
ElseIf oResults.Rows.Count > Me.ResultLimit Then
'only display the records up to the limit
'then notify user
__recordLimitWarning.Text = " " + String.Format(Me.ResultLimitText, Me.ResultLimit.ToString("N0"))
__recordLimitWarning.Visible = True
End If
'....
精彩评论