Chrome on iPad not working with ASP.NET 4

前端 未结 4 1965
深忆病人
深忆病人 2021-02-03 10:40

I just downloaded Google Chrome for iPad and I noticed that it doesn\'t work with ASP.NET 4 websites!

For example, create a simple page:



        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 11:18

    ASP.NET may be incorrectly detecting Chrome on iPad as a "downlevel" browser that doesn't support JavaScript. ASP.NET uses the user agent string to detect down level browsers. To force Chrome to be detected as an "uplevel" browser, you can do this:

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

提交回复
热议问题