I used the following code in the cs file of the masterpage to fix the rendering issue of the safari and the asp:menu control. I was curious on why it actually fixes the problem. Here is the code:
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);
}
From stackoverflow
-
The problem is that ASP.NET erroneously recognizes Safari as a "downlevel" browser (e.g. ancient). Your fix is forcing it to recognize it as a more modern browser that is capable of handling some of the menu's javascript.
This will also work via a bunch of other techniques such as overriding Page_PreInit or adding a properly configured safari.browser to App_Browsers.
Xaisoft : Any reason why asp.net would recognize safari as a "downlevel" browser? What was Microsoft thinking?Keltex : I've read on the web that under certain circumstances asp:menu actually crashes older versions of Safari. So maybe that's why.
0 comments:
Post a Comment