Chrome only renders menu first time

Last post 11-27-2009 3:15 AM by Tony1010. 9 replies.

Sort Posts:

  • Sleep [|-)] Chrome only renders menu first time

    06-26-2009, 12:17 PM
    • Member
      point Member
    • cbspira
    • Member since 06-26-2009, 4:05 PM
    • Posts 4

    I've been searching for this several days - I'm hoping someone out there can help.

    I'm using the css friendly menu adapter on a master page.  It looks fine on IE7 and Firefox. My problem is with Chrome - it only renders properly the first time the page is loaded after launching the VWD dev server - as soon as I click on a menu item or even just reload the page the menu looks like a poor rendition of the asp:menu control. I've even ascertained that something is different because the "view source" for the page is different - the first load it has the menu as expected, with ul and li - and with subsequent loads it is rendered as a table.


    As per my multiple searches, I've added the Request.Browser.Adapters.Clear() fix to the page load of the master page. This helped render the asp:menu control to begin with (before this the submenu items would display with the word "Expand" that then had to be clicked)

    I also tried using the ClientTarget="uplevel" fix to the pre-init of a single page (to test it out)  - did not appear to make a difference here either.

    I'm imagining that if I'm having this problem with Chrome then it's a problem with Safari as well, so I would like to get this issue resolved...


    Thanks,

    CB

  • Huh? [:^)] Re: Chrome only renders menu first time

    06-29-2009, 12:37 AM
    • Member
      point Member
    • cbspira
    • Member since 06-26-2009, 4:05 PM
    • Posts 4

    Still have not found the reason for this. However, I did load the pages on my commercial host (as opposed to only testing with the VWD dev server) - and the menu is rendering properly (ie, as an unordered list with the appropriate CSS class applied) in Chrome and FireFox (and IE).

    This is making testing a bit cumbersome, but at lease I can go live with this...

    If anyone does have any ideas as to why this happened please let me know - I'm afraid that maybe the dev server got corrupted somehow and now I don't know if I can trust other output...

    Thanks,

    CB

  • Re: Chrome only renders menu first time

    07-20-2009, 6:12 PM
    • Member
      8 point Member
    • pfontyn
    • Member since 05-07-2009, 1:46 AM
    • Posts 5

    Did you ever find a solution to this problem? I seem to have managed to take it one step further than you - when I browse the website using chrome on the commercial web server, it messes up the menu for clients in other locations using different browsers. 

    I'm absoloutly stumped with this as it leads me to believe that chrome is somehow writing something to the server. 

  • Re: Chrome only renders menu first time

    07-20-2009, 8:03 PM
    • Member
      8 point Member
    • pfontyn
    • Member since 05-07-2009, 1:46 AM
    • Posts 5

    It seems as though when the aspnet_wp (or WebDev.Webserver.exe, depending on config, probably) gets recycled, it re-sets the page so that images will load properly in supported browsers again.

    This doesn't really clear anything up for me, but it adds a bit of information to the subject.

  • Re: Chrome only renders menu first time

    07-22-2009, 7:27 PM
    • Member
      8 point Member
    • pfontyn
    • Member since 05-07-2009, 1:46 AM
    • Posts 5

    Ok, I'm not 100% sure on this, but it looks as though this is the problem.

    For whatever reason, when a link in the menu is clicked using chrome, it appears as though it generates extra scriptresource and webresource files - which IE then apparently uses. Basically it seems as though all browsers from that point on seem to lose the stylesheet - which leads me to believe that it's not being rendered properly when the webresource files are compiled.

    I don't know what chrome would be sending to the server that would cause this - I stripped out the css friendly code, bashed together a some styles for the standard menu control and everything seems to be working properly.

     

    P.

  • Re: Chrome only renders menu first time

    07-22-2009, 10:09 PM
    • Member
      point Member
    • cbspira
    • Member since 06-26-2009, 4:05 PM
    • Posts 4

    Sorry for not replying sooner - I've been off-line...

    I never did figure it out - for some reason chrome does render it properly on the comercial host (IIS 7, if I'm not mistaken). IE6 does NOT render it at all - the whole menu control does not display (but that was reported to me by mthe customer  - I do not have a way to test it out currently, so I don't know what the generated html really looks like)

    FWIW, if you can get it to work, there's a way to specify a skin to be used if the browser will not support the control adapter (or if you specify for it not to use the adapter). See here:

    http://www.asp.net/CSSAdapters/WalkThru/WalkThrough.aspx#SimpleMenu

    and here:

    http://www.asp.net/CSSAdapters/WhitePaper.aspx#SamplesUsingInYourWebSite

    (although I personally have not gotten the skin to work too well, but that could very well be my lack of knowledge on how to integrate css styles in the skin)

    But why does it seem to work for all other browsers that purport to be on a similar level of compliance? And why are we the only ones asking about this? :-)

    Good Luck,

    CB



  • Re: Chrome only renders menu first time

    09-20-2009, 2:11 PM
    • Member
      4 point Member
    • danielgindi
    • Member since 09-20-2009, 6:09 PM
    • Posts 2

    Hi!


    I had the same problem, and there's a simple fix, which I took from here:

    http://dotnetslackers.com/Community/blogs/kaushalparik/archive/2009/02/13/asp-menu-server-control-cross-browser-compatibility-safari-chrome.aspx

    add this:

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



    to your Page_Init or Page_Load event (in master page if you want),

    and this will fix all the problems: the CSS rendering problem, the "rendering only first time" problem, and the not rendering dynamic menus at all problem...


    Have fun!

    Daniel

  • Re: Chrome only renders menu first time

    09-20-2009, 2:13 PM
    • Member
      4 point Member
    • danielgindi
    • Member since 09-20-2009, 6:09 PM
    • Posts 2

    BTW, if you want to be more accurate and prevent possible Adapter problems of other controls, you can add a code block inside the IF, to search for the specific asp:Menu adapter, and kill it.

  • Re: Chrome only renders menu first time

    09-21-2009, 1:05 AM
    • Member
      point Member
    • cbspira
    • Member since 06-26-2009, 4:05 PM
    • Posts 4

     Thanks for the reply, but if you look at my initial post you'll see that I already tried that method (and added it to the page load of the master page)

    What has been working so far with the  VWD server (but I have not fully tested it live on the comercial host, so I did not update this thread) is adding the following to the pre-init of the base page (which I guess would be the equivalent of adding it to the pre-init of the master page if a base page is not used?)

        If (Request.UserAgent.IndexOf("AppleWebKit") > 0) Or (Request.UserAgent.IndexOf("Unknown") > 0) Or (Request.UserAgent.IndexOf("Chrome") > 0) Then
          Page.ClientTarget = "uplevel"


    This was cobbled from assorted sources - unfortunately I do not remember where so I can not credit them appropriately...

    Thanks anyway...

  • Re: Chrome only renders menu first time

    11-27-2009, 3:15 AM
    • Member
      2 point Member
    • Tony1010
    • Member since 11-27-2009, 3:13 AM
    • Posts 1

    Hi!

    Did not work for me either...

    BR,

    Tony


Page 1 of 1 (10 items)