I know there are a ton of posts on the ASP:Menu vs. WebKit issue in general, but I cannot find one that answers my question.
I frequently see people recommending two different methods to fix the problem with ASP:Menu
s in Apple WebKit browsers (i.e., Chrome, Safari). But which is actually better? What is the difference between these two actions besides the targeted user agent? The only difference I found is that the second will also work on the Page_Load
event. I assume one is objectively superior to the other, but I do not know the difference between them. How do each of them work?
Both go in the Page_PreInit()
method of the base page.
1. Clear the browser adapters.
if (Request.UserAgent.Contains("AppleWebKit"))
{
Request.Browser.Adapters.Clear();
}
2. Change the client target.
if (Request.UserAgent.Contains("Safari"))
{
Page.ClientTarget = "uplevel";
}
The default user agent for Google Chrome is as follows. It contains both Safari and WebKit, so I doubt the targeted user agent is a significant difference.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.X.Y.Z Safari/525.13.