0

I have created a clone button of "Save" button. When I modify any field and save it with the click of this clone button, it is saved. But while attaching/removing any file and saving this change using the click of this clone button, I got below error:

Access to strict mode caller function is censored

Any help in this !!


Below is the workaround provided in link.

function hackEventWithinDoPostBack() {
    var originalEventDescriptor = Object.getOwnPropertyDescriptor(Window.prototype, "event");
    var hackEventVariable = false;
    var eventPropertyHolder;
    Object.defineProperty(window, "event", {
        configurable: true,
        get: function get() {
            var result = originalEventDescriptor ? originalEventDescriptor.get.apply(this, arguments) : eventPropertyHolder;
            if (result || !hackEventVariable)
                return result;
            return {};
        },
        set: function set(value) {
            if (originalEventDescriptor)
                originalEventDescriptor.set.apply(this, arguments);
            else
                eventPropertyHolder = value;
        }
    });

    var originalDoPostBack = window.__doPostBack;

    window.__doPostBack = function hackedDoPostBack() {
        hackEventVariable = true;
        originalDoPostBack.apply(this, arguments);
        hackEventVariable = false;
    };
}

1 Answer 1

0
  • Make sure you are using latest Firefox version. It seems a Firefox problem.
  • Try with a different browser.
  • Make sure your cloned button have the same JavaScript inline like original button.
  • Check this link
4
  • I tried every mentioned options but nothing work for me. I am facing this issue in FF and IE. It is working fine in Chrome. Commented Jan 24, 2018 at 12:42
  • @DivyaSharma Have you even tried modifying the script mentioned in the link in fourth option and refreshing cache’s browser?
    – Sergio
    Commented Jan 24, 2018 at 13:05
  • Yeah, I have placed the above mentioned function in my script but again I am getting the same error. Commented Jan 24, 2018 at 13:36
  • I have commented on Dave's question, because he did the same question.
    – Sergio
    Commented Jan 24, 2018 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.