简体   繁体   中英

ASP.NET Menu control and Safari 4.0.3

So I'm using a Menu control on my page, and it has dynamic items that should drop down when you hover over a menu item. This works in all browsers except for Safari 4.0.3.

I've looked around and there seem to be several solutions to this problem:

  1. Add this code to the Page_Load event:
if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
    {
        Request.Browser.Adapters.Clear();
    }
  1. Add this code to the Page_PreInit event:

     if (Request.UserAgent.IndexOf("AppleWebKit") > 0) \n{ \n    this.ClientTarget = "uplevel"; \n}  
  2. Add a browser file like in this thread: Link to thread

Well I've tried all of those, and none of them seem to work.

I should mention that this did use to work in older versions of Safari using option #2. But it's not working for me with the newest version of Safari.

Does anyone know how to fix this?

您是否尝试过在实际的@Page指令中添加ClientTarget =“ uplevel”?

Have you tried using the CSSAdapters version of the Menu? It produces much cleaner, semantic HTML and should be easier to style, too.

Try this in your .browser file:

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

(from the top of my head, so exact syntax might be wrong)

The key is <browser refID="Safari"> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM