W3cubDocs

/JavaScript

arguments.caller

Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

The obsolete arguments.caller property used to provide the function that invoked the currently executing function. This property has been removed and no longer works.

Description

This property is not available anymore, but you can still use Function.caller.

function whoCalled() {
   if (whoCalled.caller == null)
      console.log('I was called from the global scope.');
   else
      console.log(whoCalled.caller + ' called me!');
}

Examples

The following code was used to check the value of arguments.caller in a function, but doesn't work anymore.

function whoCalled() {
   if (arguments.caller == null)
      console.log('I was called from the global scope.');
   else
      console.log(arguments.caller + ' called me!');
}

Specifications

Not part of any standard. Implemented in JavaScript 1.1 and removed in bug 7224 due to potentially vulnerable for security.

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support No No No ? — 9 No No
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support No No No No No No No
Server
Node.js
Basic support No

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/caller