Pipalayan Nayak
Pipalayan Nayak

Reputation: 957

not able to use dojo widgets in opensocial gadget inside apache shindig container

I am not able to use dojo widgets in my open social gadget. Here is the steps i followed
1. I am using apache shinding in tomcat 6.0.29 in my local machine. Tomcat is running on default port 8080. 2. This is the gadget xml

  </ModulePrefs>
  <Content type="html">
    <![CDATA[
 <link rel="stylesheet" ....type="text/css"/>
 <script type="text/javascript" src="path/to/local/dojo.js"></script>
    <script>
    function loader () {
        dojo.require ("dijit.Editor");
        dojo.addOnLoad(callback);
    }

    function callback () {
        new dijit.Editor ({}, dojo.byId("editorNode"));
    }

    dojo.config.parseOnLoad = true;
    dojo.config.dojoBlankHtmlUrl = '/blank.html';
    dojo.addOnLoad(loader);
</script>
<div id="editorNode" class="tundra">Hello, xcc world!</div>

    ]]>
  </Content>
</Module>
  1. I am testing this gadget in the default samplecontainer of apache shindig. I tested in google chrome and i am getting the following error in the javascript console

    Origin http://127.0.0.1:8080 is not allowed by Access-Control-Allow-Origin. Uncaught Error: Could not load 'dijit.Editor'; last tried '../dijit/Editor.js'

Upvotes: 0

Views: 802

Answers (1)

John Kurlak
John Kurlak

Reputation: 6680

From what I can see, you're getting a cross-domain permission error. What this means is that you cannot load the editor dijit because dojo tries to load it with Ajax (and Ajax cannot access resources on a different domain). As silly as this sounds, 127.0.0.1:8080 is considered a different domain from localhost:8080.

Therefore, instead of accessing your shindig server from http://127.0.0.1:8080, try accessing it from http://localhost:8080.

Let me know if that helps.

Upvotes: 0

Related Questions