Technical Difficulties

While working on the product for Intense Debate I recently ran into a little snafu. For those of you that don’t know this (which I didn’t until just recently), Ajax does not work across domains. In other words, a page on example.com can not send Ajax requests to another page at anothersite.com. Apparently this was done as a security precaution…which I don’t really understand since just about every other method of communication on the web works fine from one domain to another. It was definitely a set back for our project though….we rely quite heavily on Ajax (between domains) for our product to work.

Turns out there is a relatively simple (though not quite as nice) work around with a creative use of the script tag. Essentially, you use a newly created script tag that passes values inline in the url back to the remote server. The server then returns a script that calls whatever function would normally be called on a successful post of the traditional Ajax methods. It’s not quite as clean, and some browsers will virtually hang during the communication stage, but it allows dynamic background communication. In other words, it works.

This was definitely a potentially large setback. It would’ve all but meant the death of our product had we not found a functional workaround. And thus I wanted to write this post as a resource for those who might not already know this. Ajax does not work across domains. And the work around is a creative use of the script tag. Feel free to email me if you happen to need a little more in depth explanation of this technique. It really is rather simple though. Just wish someone would’ve told me…could’ve saved me a couple of hours of confusion and research as to why my application didn’t work.

This entry was posted in General. Bookmark the permalink.

38 Responses to Technical Difficulties

  1. Jon says:

    New comment

  2. Jon says:

    New comment

  3. Jon says:

    New comment

  4. Jon says:

    New comment

  5. Jon says:

    New comment

  6. Jon says:

    New comment

  7. Jon says:

    New comment

  8. Jon says:

    This comment system rocks!

  9. Jon says:

    This comment system rocks!

  10. Jon says:

    This comment system rocks!

  11. Jon says:

    This comment system rocks!

  12. Jon says:

    This comment system rocks!

  13. Jon says:

    This comment system rocks!

  14. Jon says:

    Heck yeah it does!

  15. Jon says:

    Heck yeah it does!

  16. Jon says:

    Heck yeah it does!

  17. Jon says:

    Heck yeah it does!

  18. Jon says:

    Heck yeah it does!

  19. Jon says:

    Heck yeah it does!

  20. ID most definitely rocks, I agree with the Jons

  21. ID most definitely rocks, I agree with the Jons

  22. ID most definitely rocks, I agree with the Jons

  23. ID most definitely rocks, I agree with the Jons

  24. ID most definitely rocks, I agree with the Jons

  25. ID most definitely rocks, I agree with the Jons