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

[亡魂溺海] 提交于 2019-11-29 09:18:39

问题


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?


回答1:


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>


来源:https://stackoverflow.com/questions/12326736/asp-net-webforms-doesnt-render-postback-javascript-function-for-chrome-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!