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
Adding ClientTarget="uplevel"
to the page directive like so makes Safari work:
<%@ Page ClientTarget="uplevel" ... %>
Mayank Sharma found a solution that works with master pages, rather than editing individual pages. All pages that use the master page are fixed seamlessly. It's still a hack, but you do what you have to. Here's a barebones example master page code behind.
using System;
using System.Web.UI;
/// <summary>
/// Summary description for ExampleMasterPage
/// </summary>
public class ExampleMasterPage : MasterPage
{
public ExampleMasterPage() { }
protected override void AddedControl(Control control, int index)
{
if (Request.ServerVariables["http_user_agent"]
.IndexOf("Safari", StringComparison.CurrentCultureIgnoreCase) != -1)
{
this.Page.ClientTarget = "uplevel";
}
base.AddedControl(control, index);
}
}
Works like magic!
If Request.ServerVariables("http_user_agent").IndexOf("Safari", StringComparison.CurrentCultureIgnoreCase) <> -1 Or Request.UserAgent.Contains("AppleWebKit") Then
Request.Browser.Adapters.Clear()
Page.ClientTarget = "uplevel"
End If