The popular Apple Safari browser is available on Windows since 2007. So now, the famous “I don’t have a Mac” reason is no longer acceptable when developing Web site that target everyone. This is not a big deal, unless you want to use the ASP.NET Menu control on your web site. There is as small issue with the rendering of that control inside Safari browser and prevent sub-menu items to be displayed.
Here is a sample Web page viewed with Safari 5. The page contains a Menu control and some labels to show information about the selected menu items.
We can see that the “Support” menu items contains sub-menu items but even when the mouse hover that menu items, the sub-menu doesn’t show. One quick and easy solution to fix this problem is to set the Page.ClientTarget property to “uplevel” in the page pre init event.
For those of you who don’t know, the Page.ClientTarget property allows you to override the automatic detection of browser capabilities and to specify how a page is rendered for a particular browser client.
More information about the ClientTarget property can be found on MSDN Web site:
Here is the C# code for setting the Page.ClientTarget property:
And the VB code:
Please note that this needs to be implemented on all Web pages on which the menu should be.
For those of you that would like to see how their Web sites look on Safari but doesn’t have an Apple computer, you can download the Windows version of Safari browser here: