locked
__doPostBack() does not work in iOS browsers RRS feed

  • Question

  • User1594507732 posted

    Hi everyone,

    I'm developing an ASP.NET Webform website using .NET Framework 4.6, C# and Javascript,

    I've used HiddenField to store a value from a navigation drawer, then do a postback to update value in UpdatePanel, but seem that the code stucked at __doPostBack() on iOS browsers (all Safari, Chrome, Firefox), for Windows browsers everything works fine. Below is my Javascript code:

    function headChange(e) {

          __doPostBack('<%=HiddenField1.ClientID%>', '');

    };

    I tried several methods found on Internet such as:

    - Added <browserCaps userAgentCacheKeyLength="256"/> in web.config

    - Added return false; after __doPostBack('<%=HiddenField1.ClientID%>', '');

    - Replace __doPostBack('<%=HiddenField1.ClientID%>', ''); by <%= Page.ClientScript.GetPostBackEventReference(HiddenField1, String.Empty) %>;

    - Added a browser file to App_Browsers folder

    but all with no luck,

    Has anyone encountered the same problem and found the solution for this?

    Thank you very much!

    Friday, October 16, 2020 4:19 AM

All replies

  • User-474980206 posted

    if its just agent string, use chrome and go into device emulation and pick an iOS device. it will send an IOS agent string. if this doesn't work, you will need to debug via a mac.

    most likely you are getting a script error. on your IOS device under settings you can enable web inspector (remote debug) for the browser. Then connect your iOS device to a mac. on the mac open safari, and use its web inspector to debug the iOS web page.

    you can also run the iPhone emulator on the mac instead of a real device.

    note: to debug chrome on the iOS, you need a custom chrome build with web inspector support. 

    Friday, October 16, 2020 6:51 PM
  • User1594507732 posted

    Dear Bruce, 

    Thank you very much for your support, I will try to fix my code as your suggestions and get back to you later 

    Saturday, October 17, 2020 5:16 AM
  • User1594507732 posted

    I found the error by do  Inspect Element in Sarari, the error is shown as follow:

    https://ibb.co/ynL1Zhp

    "Function.caller used to retrieve strict caller" cause by __doPostBack function in MicrosoftAjaxWebforms.js

    Then I found the solution for this by https://stackoverflow.com/a/25686598/7819116

    Now my website works well in iOS browsers

    Thank you all for the supports!

    Monday, October 19, 2020 3:56 AM