Javascript access denied error on page partial load - why?
<p>On <strong>thirdpartydomain.com</strong> I want to embed a simple <code>&lt;script&gt;</code> tag that pulls in a script from <strong>mydomain.com/myscript.js</strong>, which simply creates a little <code>&lt;div&gt;</code> and pulls partial page content from <strong>mydomain.com/mypage.htm</strong>.</p>

<p>Here's the script, adapted from: <a href="http://stackoverflow.com/questions/2170439/how-to-embed-javascript-widget-that-depends-on-jquery-into-an-unknown-environment">How to embed Javascript widget that depends on jQuery into an unknown environment</a></p>

<pre><code>var myEmbedId = '12345';
var myEmbedContainerId = 'myEmbedContainer_' + myEmbedId;
document.write('&lt;div id="' + myEmbedContainerId + '"&gt;IF ALL GOES WELL, THIS TEXT WILL BE REPLACED WITH MYPAGE.HTM CONTENTS');
document.write('&lt;/div&gt;');

    (function (window, document, version, callback) {
        var j, d;
        var loaded = false;
        if (!(j = window.jQuery) || version &gt; j.fn.jquery || callback(j, loaded)) {
            var script = document.createElement("script");
            script.type = "text/javascript";
            script.src = "http://mydomain.com/jquery-1.4.1.min.js";
            script.onload = script.onreadystatechange = function () {
                if (!loaded &amp;&amp; (!(d = this.readyState) || d == "loaded" || d == "complete")) {
                    callback((j = window.jQuery).noConflict(1), loaded = true);
                    j(script).remove();
                }
            };
            document.documentElement.childNodes[0].appendChild(script)
        }
    })(window, document, "1.3", function ($, jquery_loaded) {
        $(document).ready(function () {
            alert('jquery loaded!');

            var myRefreshUrl = 'http://mydomain.com/mypage.htm';
            alert('refreshing from ' + myRefreshUrl);

            $.get(myRefreshUrl, function(data){ 
                var returnData = data;
                alert('return data: ' + data);
                $('#' + myEmbedContainerId).html(data); });

            alert('load complete v2');

        });
    });
</code></pre>

<p>In IE, I get an Access Denied error from Javascript; in Firefox I just get no data returned.</p>

<p>What's wrong with this?</p>
