asp.net menu control not rending correctly in safari

后端 未结 9 978
没有蜡笔的小新
没有蜡笔的小新 2020-12-31 17:56

The site I\'m working on is using a Databound asp:Menu control. When sending 1 menu item it renders HTML that is absolutely correct in Firefox (and IE), but really messed u

9条回答
  •  南方客
    南方客 (楼主)
    2020-12-31 18:56

    Here's the @Mayank Sharma / @jball C# version converted to VB.NET. Thanks for the fix guys, been bugging me for months. My problem was every browser on MAC and PC worked except IE8 and Chrome. But then Chrome, much as I like it, often fails to run Google Docs - work that out!!!

    Protected Overrides Sub AddedControl(ByVal control As Control, ByVal index As Integer)
        If Request.ServerVariables("http_user_agent").IndexOf("fake_user_agent", StringComparison.CurrentCultureIgnoreCase) <> -1 Then
          Me.Page.ClientTarget = "uplevel"
        End If
        MyBase.AddedControl(control, index)
      End Sub
    

    You'll note that I had to check for "fake_user_agent", not "Safari".

提交回复
热议问题