21. May 2007 17:24
By
seth webster
In
C# | .NET | ASP.NET
Note: This advice is provided without warranty, guarantee and manatee.
Getting the ASP.NET 2.0 Menu control to work with Safari (on OS X) proved itself to be a a bear -- not so much because of the solution, but because everyone blames MS for not fixing it instead of coming up with a solution. After some tinkering with it, I found a directive I hadn't seen before:
Page.ClientTarget
As it turns out, you can simply set Page.ClientTarget = "uplevel" and the control renders perfectly in Safari. Of course, we should ensure that we're on Safari which can be done with a simple check in Request.ServerVariables["http_user_agent"].
All in all, it looks like this: (without the spacing of course :))
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request.ServerVariables["http_user_agent"].ToLower().Contains("safari"))
{
Page.ClientTarget =
"uplevel";
}
}
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
Tags: