You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Peter Ent <pe...@adobe.com> on 2014/05/30 21:47:31 UTC

[FalconJX] Question about generated index.html

Hi,

The index.html file that is generated has a <body> element like this:


<body>

    <script type="text/javascript">

        new MapSearch().start();

    </script>

</body>

I was wondering if it would be better to do it this way:


<body onload="onLoadHandler()">

    <script type="text/javascript">

        function onLoadHandler() {

            new MapSearch().start();

        }

    </script>

</body>

I ran into a situation trying to create a <script> tag on the fly and used document.body.appendChild() and most of the time document.body was null. I experimented by altering the index.html and moving the start() of the FlexJS app inside of the onload handler.

Since I need to work with the generated index.html, I changed my script-generation code to use document.head.appendChild() and that works. Just wondering if it might be a good practice to start our FlexJS apps from within an onload handler?

Thanks,
Peter Ent
Adobe Systems