I have googled as much as I can and I'm not sure of the support for the document of an iframe getting the id of itself in the parent window: window.frameElement.id
. There are so many browsers that it's hard to test them all and nothing online seems to have any information. I'm specifically wondering about:
Safari iOS Safari Windows Phone IE IE 7, 8, 9, 10, 11
(I tested Firefox and Chrome and they both worked).
EXAMPLE IFRAME CONTENT
<!DOCTYPE HTML>
<html>
<head></head>
<body>
<script type="text/javascript">
var owner = window.frameElement;
var thisIsWhoIsCalling = ( owner !== null ) ? owner.id : null;
window.parent.SomeJavaScriptObject.someFunction( thisIsWhoIsCalling );
</script>
</body>
</html>