MenuItem – ImageUrl – No Action on Event Click, Chrome/Safari []

There is an issue with MenuItem control in with Safari/Chrome, the menu is unable to click but it’s working fine with Firefox and IE when we want to use image icon for the menu.


<asp:menuitem navigateurl="Home.aspx" 


In Firefox, the MenuItem generated the full HTML fine as following:

<span title="Home">
<a class="ctl00_LeftNaviMenu_1" href="Home.aspx">
<img src="Images\Home.gif" style="border-width:0px;" /> 

The image icon is able to click.

In Chrome/Safari, the MenuItem generated wrong HTML:

<span title="Home">
<img src="Images\Home.gif" style="border-width:0px;" /> 
<a class="ctl00_LeftNaviMenu_1" href="Home.aspx"></a>

So that we cannot click the menu (on the image) because the HTML is generated a tag wrong outside the image tag.


Safari and Chrome use webkit and in, it identifies them by “Safari1Plus“, without telling not to use an adapter to render the menu control, Chrome and Safari has always wrong control rendering in HTML.

You can google: MenuItem in Cross Browser Compatibility (Safari/Chrome)

You will see some solutions out there.

Here are what I have tried on the project with Framework 3.5 and it works.

Solution 1: Add Browser File: Chrome.browsers to folder: App_Browsers

You need to [Ref: StackOverflow]:

  • add an App_Browsers folder to the project
  • and add a new item Add New Item… Select “Browser File” and name it Chrome.browsers.
  • Comment out the default stuff and insert this from the link above:
    <browser refID="safari1plus">
            <adapter controlType="System.Web.UI.WebControls.Menu" adapterType="" />


Solution 2: Add a code snippet in MasterPage

The solution answers the same as Solution 1 but it’s just about to write directly in the MasterPage file to tell the application not to use any adapter in case in browser Chrome or Safari. [Ref: dotnetslackers]

In the MasterPage’s Page_Load event, put following code:

if (Request.UserAgent.IndexOf("AppleWebKit") > 0)

They are working for me, and you can try one.


One reply on “MenuItem – ImageUrl – No Action on Event Click, Chrome/Safari []”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.