asp:Menu Server Control - Cross Browser Compatibility (Safari/Chrome)

Cross browser compatibility struggle is getting upsetting while working with asp:Menu Server Control. Anyhow, It was not rendering/working well with Safari and Chrome. 

A bit of googling... and I have a solution for this.

I have added below small piece of code snippet in my MasterPage's Page_Load event

        if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
        {
            Request.Browser.Adapters.Clear();
        }

This will tell asp.net not to use an adapter when rendering the menu control. This will work for both Safari and chrome as well because they both use webkit which is how asp.net identifies Safari1Plus.

Comments

# asp:Menu Server Control - Cross Browser Compatibility (Safari/Chrome) « KaushaL.NET

Pingback from  asp:Menu Server Control - Cross Browser Compatibility (Safari/Chrome) « KaushaL.NET

# re: asp:Menu Server Control - Cross Browser Compatibility (Safari/Chrome)

Tuesday, September 08, 2009 11:35 AM by Andy

Hey, great post.  This fixed my menu issues right away.  Just put this code in my master page's page load event and voila!

# re: asp:Menu Server Control - Cross Browser Compatibility (Safari/Chrome)

Wednesday, October 07, 2009 8:01 AM by Vikram K

Hi Kausal,

Great post, Its really works.. This code has fixed my issues in both Chrome and Safari.

Thanks a lot.. for your great work.

Thanks,

Vikram.

# re: asp:Menu Server Control - Cross Browser Compatibility (Safari/Chrome)

Wednesday, October 07, 2009 8:03 AM by Vikram K

Thanks Kausal,

Great work.. its really help me.. menu control is working fine in both chrome and safari.

Thanks,

Vikram

# re: asp:Menu Server Control - Cross Browser Compatibility (Safari/Chrome)

Thursday, October 22, 2009 10:15 AM by JN

Great!! Thanks! solved my issue.

# re: asp:Menu Server Control - Cross Browser Compatibility (Safari/Chrome)

Friday, November 06, 2009 7:01 AM by Deepak

Thanks, this saved my time.

# re: asp:Menu Server Control - Cross Browser Compatibility (Safari/Chrome)

Saturday, November 21, 2009 7:42 AM by Leosvaldo

Great post.

I need to make changes at only one place.

# re: asp:Menu Server Control - Cross Browser Compatibility (Safari/Chrome)

Tuesday, December 01, 2009 5:04 AM by Venki

This method work fine. But I have the same issue.

# re: asp:Menu Server Control - Cross Browser Compatibility (Safari/Chrome)

Tuesday, December 01, 2009 6:00 AM by Venki

Please tell me,Is This method work for Mozilla Firefox browser?

# re: asp:Menu Server Control - Cross Browser Compatibility (Safari/Chrome)

Friday, January 08, 2010 12:47 AM by Ashwini Solanki

Really Great Solution Solution. I was wondering how to make the Asp:Menu Server control in Chrome as well as in Safri.

Thanks a Lot for your solution. It really helps me.

Thanks again .. and keep posting...