Partager via


Arguments.caller is no longer supported

As of Windows Internet Explorer 9, the arguments.caller property is not supported in IE9 Standards mode or later document modes.

The arguments.caller property works as expected in IE5 (Quirks) mode, IE7 Standards mode, and IE8 Standards mode but does not work in IE9 mode or later document modes.

Discontinue the use of the arguments.caller property or force your webpages to run in a legacy mode such as IE8 mode.

When arguments objects are created, in all modes in Windows Internet Explorer 8 and IE5 mode, IE7 mode, and IE8 mode in Internet Explorer 9, a property with the name caller is created. This caller property stores the reference to the argument object of the function that called it.

In the following example, all document modes in Internet Explorer 8 and IE5 mode, IE7 mode, and IE8 mode in Internet Explorer 9 return "1". IE9 mode issues the script error "object is null or undefined".

function alertCallerLength() {
    alert(arguments.caller.length);
}

function callingFunction() {
    alertCallerLength();
}
callingFunction(1)

For best results, pass the necessary information to the function as a separate value or object.