Skip to main content
December 30, 2013
Question

childSandboxBridge not working

  • December 30, 2013
  • 0 replies
  • 265 views

i cut and pasted the examples given in the AIR documentation and get "TypeError: Result of expression 'childInterface' [undefined] is not an object".  AIR 3.9, OS X 10.9.1.  any ideas?  thanks.

--------------

child.html:

<html>

<head>

    <title>child</title>

    <script type="text/javascript">

        var interface = {};

        interface.calculatePrice = function(){

            return ".45 cents";

        }

        interface.storeID = "abc"

        window.childSandboxBridge = interface;

    </script>

</head>

<body>

    <h1>child</h1>

</body>

</html>

---------------------

helloworld.html:

<html>

<head>

    <title>Hello World</title>

    <script type="text/javascript" src="AIRAliases.js"></script>

    <script type="text/javascript">

        function appLoad(){

            air.trace("Hello World");

        }

    </script>

</head>

<body onLoad="appLoad()">

    <iframe id='child' src='child.html'></iframe>

    <h1>Hello World</h1>

    <script>

    var childInterface = document.getElementById("child").contentWindow.childSandboxBridge;

    air.trace(childInterface.calculatePrice()); //traces ".45 cents"

    air.trace(childInterface.storeID); //traces "abc"

    </script>

</body>

</html>

This topic has been closed for replies.