Safari browser and asp:menu

Rate It (1)

Last post 09-04-2008 3:01 PM by nolazabal. 46 replies.

Sort Posts:

  • Re: Safari browser and asp:menu

    04-06-2006, 3:20 AM
    • Loading...
    • sravi
    • Joined on 01-06-2006, 4:11 AM
    • Posts 6
    thanks craigbtx. You solved a long time problem
  • Re: Safari browser and asp:menu

    08-01-2006, 6:08 PM

    I followed this thread - incredibly helpful...but with the uplevel browser I only get the first item in the submenu's - I can still hover over the "invisible" items, select them and navigate from them...

    Anybody else seeing this symptom??

    Also, is the browsecaps entry still needed with the ClientTarget Page directive?

  • Re: Safari browser and asp:menu

    08-02-2006, 8:20 AM
    • Loading...
    • craigbtx
    • Joined on 10-01-2004, 4:50 PM
    • Posts 483

    I have not experienced getting only the first item.

    I dont use browsercaps at all.

    Everything works fine!!!

  • Re: Safari browser and asp:menu

    08-02-2006, 12:18 PM

    OK - figured this one out...

    If you use the DynamicMenuStyle in addition to DynamicMenuHoverStyle and DynamicMenuItemStyle the secondary menu is clipped. Remove the DynamicMenuStyle tag and everything works perfectly.

  • Re: Safari browser and asp:menu

    12-08-2006, 3:17 PM
    • Loading...
    • meddev
    • Joined on 12-08-2006, 8:11 PM
    • Posts 4
    Thanks!  using the Page.ClientTarget = "uplevel" method worked perfectly.  I tried to edit the Mozilla.browser file by removing the asp:Menu control adaptor section for Safari browsers, but my changes had no effect even after I restarted IIS web services on the server.  Is there something else I need to do to get .browser file changes to take effect or is there some other mechanism in play that forces the down browser rendering of the asp:Menu control on Safari?
  • Re: Safari browser and asp:menu

    01-03-2007, 8:57 AM
    • Loading...
    • Kestrel42
    • Joined on 07-22-2005, 7:27 PM
    • Posts 63

    I'm wrestling with this Safari menu problem.  It's not helped by the fact that I don't possess a Mac and have to rely on e-mail correspondence with my cousin's cousin whom I only met over the Christmas holiday and who is kindly helping me out!

    I've put this:

     if (Request.ServerVariables["http_user_agent"].IndexOf("Safari", StringComparison.CurrentCultureIgnoreCase) != -1)

    Page.ClientTarget = "uplevel";

    into the Page_Init  MasterPage which contains the menu.  (Master pages don't have Page_PreInit). 

    But my cousin's cousin reports that my menu still doesn't work.

    Any suggestions?

  • Re: Safari browser and asp:menu

    01-03-2007, 11:07 AM
    • Loading...
    • craigbtx
    • Joined on 10-01-2004, 4:50 PM
    • Posts 483

    You have to put it in EVERY pages Page_Preinit event. It will not work in a master page.

    Kind of a pain but better than other alternatives like browser caps etc which I could never get working.

      Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
            If InStr(Request.ServerVariables("http_user_agent"), "Safari") Then
                Page.ClientTarget = "uplevel"
            End If
        End Sub

  • Re: Safari browser and asp:menu

    01-03-2007, 11:51 AM
    • Loading...
    • Kestrel42
    • Joined on 07-22-2005, 7:27 PM
    • Posts 63

    Thanks for the advice, Craig.

    As you say it is a big pain.  Especially as ASP.NET seemed to promise an end to cross-browser difficulties!  Presumably Microsoft will fix this in a future release?

    Rather than repeat  the same code on every page, I have created a new class called PageBase

    public class PageBase: Page
    {
    	public PageBase()
    	{
    	}
        protected void Page_PreInit(object sender, EventArgs e)
        {
          if (Request.ServerVariables["http_user_agent"].IndexOf("Safari", StringComparison.CurrentCultureIgnoreCase) != -1)
             Page.ClientTarget = "uplevel";
        }
    }
     

    and then changed all my ChildPages so that they inherit from PageBase, instead of System.Web.UI.Page

  • Re: Safari browser and asp:menu

    01-04-2007, 2:53 PM
    • Loading...
    • Kestrel42
    • Joined on 07-22-2005, 7:27 PM
    • Posts 63
    "Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)"

     in the HTML that is rendered. Instead when he clicks on a top level menu item, the whole page refreshes and returns with the second level menu and a (page up) link. Is that the best I can expect to achieve?

     

    I now have this working and my relative has confirmed that the menu displays OK on Safari.

    However, the dynamic sub-menus do not fly out.  There is no  

  • Re: Safari browser and asp:menu

    01-04-2007, 7:01 PM
    • Loading...
    • punxking
    • Joined on 01-04-2007, 11:45 PM
    • San Diego
    • Posts 1

    According to the MS documentation, using tthe "uplevel" value for the ClientTarget attribute means that it should work properly in IE vers 4.0 and later, does anyone know about older versions of Mozilla, Firefox, etc. and how they are effected?

    Many thanks...

  • Re: Safari browser and asp:menu

    01-05-2007, 3:20 AM
    • Loading...
    • Kestrel42
    • Joined on 07-22-2005, 7:27 PM
    • Posts 63

    I've just noticed that my previous post appears back-to-front, probably because I pasted some HTML into it.

    What I intended to say is that, by setting ClientTarget to uplevel for safari browsers, I have a menu which works, but not in the same way as for IE and FireFox. Specifically the sub menus do not fly out. The user needs to click on the top level menu and the page refreshes to display the sub menu, together with a "page up" link.

    What puzzles me is that if I specify ClientTarget="uplevel" for all browsers, then I get different HTML for  different browsers. The IE version includes onmouseout and onmouseover event handlers while the Safari version does not. This seems inconsistent with the documentation which says "If you do set this property, client browser detection is disabled and the page will use browser capabilities associated with the named alias"

    I feel like I'm trying to assemble a jigsaw of information but the pieces don'f fit together. Can anyone explain what's going on?

  • Re: Safari browser and asp:menu

    02-19-2007, 12:05 PM
    • Loading...
    • Knoter
    • Joined on 02-19-2007, 4:51 PM
    • Posts 8

    I did try this solution, which works for the most part:

    Create a PageBase Class, then inherit PageBaseClass on every page.

    This simply is unacceptable, especially given Microsoft claims cross-browser compatibility.

    Create a new page and forget to set Inherits PageBaseClass and the menus don't work.

    This and other threads have been going for nearly 2 years on this issue and Microsoft has not resolved a very basic and incredibly important issue.

    We're going to be pushing 500 pages on our new website, and we have to change EVERY page's code-behind? Oh, sure, a global Find/Replace makes it "quick" enough, but when new pages are added and one 'forgets' to modify the Inherits line; not good at all.

    Super Angry

    Here's my code snippet:

    'Global code for System.web.UI.Page

    Option

    Explicit On

    Option

    Strict On

    Imports

    Microsoft.VisualBasic

    Public

    Class PageBaseClass

    Inherits System.Web.UI.Page

    Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit

    If Me.Request.ServerVariables("http_user_agent").ToLower.Contains("safari") Then Page.ClientTarget = "uplevel"

    End Sub

    End

    Class

     

    '===========================================

    'Page-level code

    Option

    Explicit On

    Option

    Strict On

    Partial

    Class Home

    Inherits PageBaseClass

    End

    Class

     
  • Re: Safari browser and asp:menu

    02-19-2007, 9:56 PM
    • Loading...
    • snerdini
    • Joined on 02-20-2007, 2:55 AM
    • Posts 1

    craigbtx:

    If you put ClientTarget="uplevel" in the page directive <%@ Page ClientTarget="uplevel" ......%> Safari works totally!!!!!

    You rock! That totally fixed the problem I was having! Yes

  • Re: Safari browser and asp:menu

    06-04-2007, 10:28 AM
    • Loading...
    • michielvoo
    • Joined on 02-11-2007, 2:52 PM
    • Rotterdam
    • Posts 166

     Hello,

    maybe I can help you all with this issue as well. What I did to enable the asp:menu for Safari was to add a file called safari.browser to the App_Browsers folder. The contents of safari.browser are as follows:  

    <browsers>
    <browser refID="safari1plus">
    <controlAdapters>
    <adapter controlType="System.Web.UI.WebControls.Menu" adapterType="" />
    </controlAdapters>
    </browser>
    </browsers>

    Basically the refID matches a browser id in the original browser configuration files for the .Net framework. In our custom .browser file we override the control adapter settings for the asp:menu control for this specific browser.

    There's one catch. Safari will crash when the browser window is too small to contain all the items in the menu and you hover over then out of the menu. I can not confirm this is true for Safari in general, but I have consistently seen this behavior on a Mac with OS X 10.3 and Safari 1.3, so be sure to test this case. This might be the reason that Microsoft decided to render an alternative menu for Safari.

    Let me know how this works out for you, I'd appreciate any feedback on this solution. Thanks! 

    When you have asked a question, remember to click "Mark as answered" for a reply that answered your question. This ensures the right forum member gets credits (and it makes search more relevant too).
  • Re: Safari browser and asp:menu

    06-28-2007, 3:14 PM
    • Loading...
    • amcclorey
    • Joined on 11-17-2006, 10:45 AM
    • Posts 19

    Well fareplay to you craigbtx. I was trying to solve that for a while.

    Thanks

    Anthony

Page 2 of 4 (47 items) < Previous 1 2 3 4 Next >