Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Webforms Doesn't Render Postback JavaScript Function for Chrome/iOS

When we supply the user agent Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X; en-us) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/21.0.1180.80 Mobile/9A405 Safari/7534.48.3 to our .NET 4 webforms app, the script that defines the function __doPostBack is not present on the page and thus nothing that uses it works.

If we supply any other user agent string (say, Safari) it works fine. Can someone explain this?

like image 710
lukiffer Avatar asked Sep 07 '12 23:09

lukiffer


1 Answers

So the problem is that the Chrome user agent isn't recognized by .net and so it assumes that it's dealing with a low-level browser.

To solve, we added ~/App_Browsers/CriOS.browser with the following contents:

<browsers>
    <browser id="CriOS" parentID="Safari">
        <identification>
            <userAgent match="CriOS" />
        </identification>

        <capabilities>
            <capability name="browser" value="CriOS" />
            <capability name="ecmascriptversion" value="3.0" />
            <capability name="javascript" value="true" />
            <capability name="javascriptversion" value="1.7" />
        </capabilities>
    </browser>
</browsers>
like image 180
lukiffer Avatar answered Nov 12 '22 13:11

lukiffer