none
Javascript: __doPostBack recently stopped working in Internet Explorer 11.4xxx. RRS feed

  • Question

  • Hi all 

    I have an ASP.Net application targeting .Net4.5 framework. Using Jquery in the $(document).ready method I call __doPostBack if certain localstorage data is not present. 

    This works 100% in Chrome

    Recently the __doPostBack call has been failing in IE with the following error

    "TypeError: Accessing the 'caller' property of a function or arguments object is not allowed in strict mode\n   at Sys.WebForms.PageRequestManager.prototype._doPostBack 

    its fails in Jquery.3.1.1.js at mightThrow (http://localhost:51992/Scripts/jquery-3.1.1.js:3570:10)

    Any ideas why this would happen? I have followed Scott Hanselmans suggestion of installing Nuget browser update files but no solution.

    Thanks!


    Laurence Lemmon-Warde

    Thursday, November 10, 2016 6:28 PM

Answers

  • our long search is over - found a workaround!

    for anyone in same situation the only solution out of 100s of suggestions for me was

    Adding a setTimeout

    setTimeout(function () { __doPostBack('ButtonPostBack', ""); }, 1);


    Laurence Lemmon-Warde

    • Marked as answer by Laurence73 Thursday, November 10, 2016 6:44 PM
    Thursday, November 10, 2016 6:44 PM

All replies

  • Hi Rob - thanks yes I have already done that unfortunately! Still not working :-(

    Laurence Lemmon-Warde

    Thursday, November 10, 2016 6:36 PM
  • our long search is over - found a workaround!

    for anyone in same situation the only solution out of 100s of suggestions for me was

    Adding a setTimeout

    setTimeout(function () { __doPostBack('ButtonPostBack', ""); }, 1);


    Laurence Lemmon-Warde

    • Marked as answer by Laurence73 Thursday, November 10, 2016 6:44 PM
    Thursday, November 10, 2016 6:44 PM
  • Hi,

    can you provide us a testable link please?

    It is unusual to "I have an ASP.Net application targeting .Net4.5 framework. Using Jquery in the $(document).ready method I call __doPostBack if certain localstorage data is not present. "  ..... as the postback will contain no changes to the formData....

    Assuming you are targeting IE11 emulation try falling back to a JSON varible if the localstorage data is not present.

    fist to a head script block add these storage prototypes...

            Storage.prototype.setObject = function (key, value) {
                this.setItem(key, JSON.stringify(value));
            }
    
            Storage.prototype.getObject = function (key) {
                return JSON.parse(this.getItem(key));
            }
    

    then (again in a head script block..... storage is present even before the DOM is parsed) query localstorage and if localstorage is disabled (see Advanced tab of Internet Options) or the storage variable is empty, fall back to an inline variable.

    eg.

            var userConfig = localStorage.getObject('userConfig');
            if (!userConfig) {
                var userConfig = {visits:0,bkcolor:'lime'};}
            userConfig.visits++;
    

    in the domready call, populate the form elements with values read from the JSON variable, that you initiate above.

    have you asked in the jquery support forums?

    Regards.


    Rob^_^

    Thursday, November 10, 2016 7:14 PM
  • Hi Rob - I found a temporary solution which involved adding a JS timeout. I will test your solution too - thanks I appreciate the assistance!

    Laurence Lemmon-Warde

    Friday, November 11, 2016 11:01 AM
  • Hi Laurence,

    thx for the feedback.... glad to here you've found a workaround of your own.... just step back for a minute... let the problem stew... add the final ingredients, then serve!

    Regards.


    Rob^_^

    Friday, November 11, 2016 7:48 PM
  • Increasing from 1 to 500 helped in IE11 (see Laurence answer)
    Tuesday, June 25, 2019 2:22 PM