0

I am attempting a cross domain request with dojo. External url is of MIME type text/html the only content on the page is something like 1236. I tried

dojo.require("dojo.io.script");
    dojo.ready(function() {
      dojo.io.script.get({
          url: "theexternalurl",
          callbackParamName: "jsoncallback",
          load: function(data) {
              console.log(data);
          }
     });
});, 

But that was no good. Any ideas on how this can be done with dojo?

mike
  • 107
  • 2
  • 7

1 Answers1

0

I suspect you are bumping into the browser security here. Cross-domain requests will only work when using iframes or injecting scripts (as you have done) and when the content of that script is valid "text/javascript".

If you are trying to load "text/html" into the script, it won't work as it isn't a valid script. It is something most of us have tried to do at some point. I have spent hours trying to get around cross-domain restrictions and found the security blocking it to be solid.

See my answer here for more details.

If all you are trying to do is load the content onto the page then you could use an <iframe>. However, if you are trying to parse the loaded content in some way than I'm afraid it is a dead-end. Probably not the answer you were hoping for but it'll save you hours of frustration.

Community
  • 1
  • 1
Stephen Simpson
  • 1,381
  • 1
  • 11
  • 23