Advertisement

07.31.2007 at 02:34AM PDT, ID: 22731091
[x]
Attachment Details

Workarounds for Cross Domain (localhost + other) AJAX calls?

Asked by TimYates in JavaScript, Java Programming Language

Tags: cross, domain, ajax

I have a website where I am using DWR to call the server in an AJAX style, however I now have a requirement to show user related data alongside that stored on the server.

My initial thought was that I could run a Java application (embedding Jetty) on the user's machine, and then load JSON from it by using an XHR request using the localhost:8888 url.

However, I'm getting security exceptions on the XHR.open method...

I thought you were allowed to load stuff from localhost?  I guess not, when the main page url isn't from there...

Does anyone have any ideas on how this can be done?  I don't want to upload the user's data (as it's huge), and so far I have the following ideas -- just wondering if anyone had any experience and knew of a way of getting this to work?

1)  Have the server running on localhost serve an html page which can be loaded into a hidden IFRAME on the main page.  Then have this IFRAME load the data into a JSON object from localhost, and then pass this JSON object back to the parent window (sounds convoluted, and would be nice to know if it might work before I try it)
2)  Do it the way I am doing it, but do it right ;-)  (I accept that the way I'm doing it MIGHT work, and it's just I have given up too easily)
3)  Forget about it...  It can't be done... (I know this is always a possible solution to problems like this)

Anyway...hope someone who has walked this path before can help :-)

Cheers!

TimStart Free Trial
 
Loading Advertisement...
 
[+][-]07.31.2007 at 02:45AM PDT, ID: 19598787

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Java Programming Language
Tags: cross, domain, ajax
Sign Up Now!
Solution Provided By: mplungjan
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.31.2007 at 02:47AM PDT, ID: 19598795

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.31.2007 at 02:49AM PDT, ID: 19598800

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.31.2007 at 02:49AM PDT, ID: 19598803

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.31.2007 at 03:22AM PDT, ID: 19598947

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.31.2007 at 04:24AM PDT, ID: 19599266

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.31.2007 at 05:50AM PDT, ID: 19599845

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32