简体   繁体   English

ASP.NET菜单控件和Safari 4.0.3

[英]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. 此功能适用于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: 将此代码添加到Page_Load事件:
if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
    {
        Request.Browser.Adapters.Clear();
    }
  1. Add this code to the Page_PreInit event: 将此代码添加到Page_PreInit事件:

     if (Request.UserAgent.IndexOf("AppleWebKit") > 0) 如果(Request.UserAgent.IndexOf(“ AppleWebKit”)> 0)\n{ {\n    this.ClientTarget = "uplevel"; this.ClientTarget =“上级”;\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. 我应该提到,使用选项#2在Safari的较早版本中确实可以使用。 But it's not working for me with the newest version of Safari. 但是,对于最新版本的Safari而言,它不适用于我。

Does anyone know how to fix this? 有谁知道如何解决这一问题?

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

Have you tried using the CSSAdapters version of the Menu? 您是否尝试过使用菜单的CSSAdapters版本 It produces much cleaner, semantic HTML and should be easier to style, too. 它产生了更清晰的语义HTML,并且样式也应该更容易。

Try this in your .browser file: 在您的.browser文件中尝试以下操作:

<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"> . 密钥是<browser refID="Safari">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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