开发者

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

开发者 https://www.devze.com 2023-02-04 13:08 出处:网络
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.

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'


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号