Take the 2-minute tour ×

It's quite simple. The Adobe AIR application's main window is an html file, and the application.xml looks like this:

    <title>window title</title>

index.html looks like this:

<script type="text/javascript" 
    src="http://www.mysite.com/mybanner.js" id="add"></script>
<script type="text/javascript">
    document.write("<h1>this is strange</h1>");
    function getJS(){
        xmlhttp = new XMLHttpRequest(); 
        xmlhttp.open("GET", "http://www.mysite.com/mybanner.js"
        if (xmlhttp.status === 200) {

            throw("Can't open url, response status is:"+xmlhttp.status);
<input type="button" onclick="getJS();" value="getJS" />

When opening the app it displays "this is strange" and alerts the source of the other script tag (the banner) but doesn't display anything. Clicking the getJS button alerts the content of the js file but still doesn't display anything. The eval causes an AIR runtime security violation. Opening the file in Internet Explorer or Firefox shows the banner so there is no error in the script or src.

I run it in flashDevelop and don't see any warnings or error in the output, can connect to any site using xmlhttprequest (usually not allowed in browsers) but can't load a simple js file from server.

Can anyone help me in solving this?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I guess document.write doesn't work if the source of the script isn't local.

share|improve this answer

Your Answer


