Safari on iPad occasionally doesn't recognize ASP.NET postback links

后端 未结 4 1397
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-16 05:15

I\'m having a really hard time pinpointing the source of an intermittent problem in an ASP.NET web application running on the Safari browser on a third-generation iPad runni

相关标签:
4条回答
  • 2020-12-16 05:40

    This SO post is similar, and says this can happen when page Output Caching is enabled.

    asp.net: __doPostBack not rendered sometime

    Are you using OutputCache?

    0 讨论(0)
  • 2020-12-16 05:40

    I placed below definition into a browser file under the App_Browsers folder and it worked perfect. ��

    <browsers>
      <browser id="safariiphone" parentID="mozilla">
        <identification>
          <userAgent match="AppleWebKit"/>
        </identification>
        <capabilities>
          <capability name="version"                         value="${version}" />
          <capability name="majorversion"                    value="${major}" />
          <capability name="minorversion"                    value="${minor}" />
          <capability name="type"                            value="Safari${major}" />
          <capability name="ecmascriptversion"               value="3.0" />
          <capability name="javascript"                      value="true" />
          <capability name="javascriptversion"               value="1.6" />
          <capability name="w3cdomversion"                   value="1.0" />
          <capability name="tagwriter"                       value="System.Web.UI.HtmlTextWriter" />
          <capability name="cookies"                         value="true" />
          <capability name="frames"                          value="true" />
          <capability name="javaapplets"                     value="true" />
          <capability name="supportsAccesskeyAttribute"      value="true" />
          <capability name="supportsCallback"                value="true" />
          <capability name="supportsDivNoWrap"               value="false" />
          <capability name="supportsFileUpload"              value="true" />
          <capability name="supportsMaintainScrollPositionOnPostback" value="true" />
          <capability name="supportsMultilineTextBoxDisplay" value="true" />
          <capability name="supportsXmlHttp"                 value="true" />
          <capability name="tables"                          value="true" />
        </capabilities>
      </browser>
    
    </browsers>
    
    0 讨论(0)
  • 2020-12-16 05:41

    Having had the same issue with a site running Umbraco in AppMode (Full Screen mode) on iOS7, I tried all the suggestions above to no avail. However, I'vee found that a slight extension of Regexident's answer above, added to the default browser, seemed to do the trick.

    <capability name="jscriptversion"       value="5.6" />
    <capability name="javascript"           value="true" />
    <capability name="javascriptversion"    value="1.5" />
    

    Check out the original post by Aristos

    I hope this helps further as it did for me.

    0 讨论(0)
  • 2020-12-16 05:53

    After finding this question on Stack Overflow with virtually the same problem, I ran the browserCaps output page suggested by Stephen and found that Safari, when run in full screen mode from a link on the iPad's home screen, appeared to our ASP.NET server as a generic, no capability browser. I applied the fix suggested by Avada Kedavra in that other question, which entailed putting this:

    <browserCaps userAgentCacheKeyLength="256" />
    

    ...into the <system.web> section of my web.config file, and also this:

    protected void Page_PreInit(object sender, EventArgs e)
    {
       if (Request.UserAgent != null && Request.UserAgent.IndexOf("AppleWebKit", StringComparison.CurrentCultureIgnoreCase) > -1)
       {
          this.ClientTarget = "uplevel";
       }
    }
    

    in the code behind file for the main web page that was acting up. Jason Kealey, the source of that other person's fix, also suggests in the comments section of his findings that it might also be helpful to add this to a .browser file in the App_Browsers folder of your ASP.NET web application:

    <browsers>
      <browser refID="Mozilla" >
        <capabilities>
          <capability name="cookies"  value="true" />
          <capability name="type" value="Uplevel" />
        </capabilities>
      </browser>
    
      <browser refID="Default">
        <capabilities>
          <capability name="cookies" value="true" />
          <capability name="type" value="Uplevel" />
        </capabilities>
      </browser>
    </browsers>
    

    Edit: I applied this fix to my application, but it broke other areas, specifically, it was identifying Chrome and Safari as "uplevel", which caused it to be detected in other areas as "IE". The code below makes this fix only apply to iDevices when not identified in the user agent as Safari:

    string ua = Request.UserAgent;
    if (ua != null
        && (ua.IndexOf("iPhone", StringComparison.CurrentCultureIgnoreCase) >= 0
        || ua.IndexOf("iPad", StringComparison.CurrentCultureIgnoreCase) >= 0
        || ua.IndexOf("iPod", StringComparison.CurrentCultureIgnoreCase) >= 0)
        && ua.IndexOf("Safari", StringComparison.CurrentCultureIgnoreCase) < 0)
    {
        this.ClientTarget = "uplevel";
    }
    
    0 讨论(0)
提交回复
热议问题