ASP.NET validators don't work on iPhone and iPad - ecmascriptversion browser definition files

We've recently had a problem that ASP.NET validators don't work on iPhone and iPad devices.

We looked into this and this is due to the fact that the devices were determined by ASP.NET to be downlevel devices.

We'd already updated our browser definition files so found this strange so took at look at what ASP.NET determined to be downlevel

-- .NET Framework source code ...
        Page page = this.Page;
        if (page == null || page.RequestInternal == null)
        {
            return false;
        }
        if (!this.EnableClientScript || page.Request.Browser.W3CDomVersion.Major < 1)
        {
            return false;
        }
        return page.Request.Browser.EcmaScriptVersion.CompareTo(new Version(1, 2)) >= 0;

So it seems that it's the W3CDomVersion and EcmaScriptVersion that are important. Though setting these in the browser definition files didn't solve the issue.

It seems that the parentID was at fault. We were inheriting from Safari which already had a browser definition file Safari60 in the system, which had EcmaScriptVersion set (but to too low a value).

We changed our definition files to inherit from Safari60 and set the appropriate ecmascriptversion  value and now everything works.




<browsers>
  <!-- Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3  -->
  <gateway id="iPhone" parentID="Safari60">
    <identification>
      <userAgent match="iPhone" />
    </identification>
    <capabilities>
      <capability name="mobileDeviceModel"               value="iPhone" />
      <capability name="mobileDeviceManufacturer"        value="Apple" />
      <capability name="isMobileDevice"                  value="true" />
      <capability name="browser"                         value="Safari" />
      <capability name="type"                            value="Safari${major}" />
      <capability name="supportsCallback"                value="true" />
      <capability name="javascript"                      value="true" />
      <capability name="layoutEngine"                    value="WebKit" />
      <capability name="ecmascriptversion"               value="1.5" />
    </capabilities>
  </gateway>
  <!-- Mozilla/5.0 (iPad; CPU OS 8_4 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H143 Safari/600.1.4 -->
  <gateway id="iPad" parentID="Safari60">
    <identification>
      <userAgent match="iPad" />
    </identification>
    <capabilities>
      <capability name="mobileDeviceModel"               value="iPad" />
      <capability name="mobileDeviceManufacturer"        value="Apple" />
      <capability name="isMobileDevice"                  value="true" />
      <capability name="browser"                         value="Safari" />
      <capability name="type"                            value="Safari${major}" />
      <capability name="supportsCallback"                value="true" />
      <capability name="javascript"                      value="true" />
      <capability name="layoutEngine"                    value="WebKit" />
      <capability name="ecmascriptversion"               value="1.5" />
    </capabilities>
  </gateway>
</browsers>



Comments

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Enable function lock for F1-F12 on HP ZBook mobile workstations