This is a continuation of over here 
<https://github.com/google/caja/issues/2030>.

I am trying to include a script in a guest page, however the script does 
not run and I get an error:

Uncaught script error: Uncaught Error: not loaded in source: "
http://localhost:8000/test.js"; at line: -1
 ses-single-frame.js:34340:5

I am using a CORS-enabled server on localhost as shown here:
~$ curl -I localhost:8000/test.js
HTTP/1.0 200 OK
...
Access-Control-Allow-Origin: *

Finally here are the code snippets:


*Host*
<html>
    <head>
        <title>Caja host page</title>
        <script type="text/javascript" src="//caja.appspot.com/caja.js"
></script>
    </head>

    <body>
        <div id="guest"></div>
        <script type="text/javascript">
            var uriPolicy = {fetcher: caja.policy.net.fetcher.USE_XHR, 
rewriter: caja.policy.net.rewriter.ALL};

            caja.initialize({
                cajaServer: 'https://caja.appspot.com/',
                debug: true
            });

            caja.load(document.getElementById("guest"), uriPolicy, function(
frame) {
                frame.code("http://localhost:8000/caja-full-guest.html";, 
"text/html")
                    .run();
            });
        </script>
    </body>
</html>


*Guest*
<html>
    <head>
        <script src="/test.js"></script>
    </head>

    <body>
        <h1 id="main">Doh!</h1>
    </body>
</html>


*Test.js*
document.getElementById("main").innerHTML = "Excellent!";

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-caja-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to