views:

132

answers:

2

Hello, I'm working on a AJAX application that pull data from a live website, I can't replicate the complete application on my local environment at the moment so in order to test if the Javascript code is working as expected I need to be able to bypass the same domain restriction on the browser (without making changes on the web server) any suggestion will be greatly appreciated.

So far I have tried modifying the prefs.js in Firefox 2 and Camino including the lines suggested in this link: http://www.zachleat.com/web/2007/08/30/cross-domain-xhr-with-firefox/

Thanks in advance.

Edit 04/29/2009 3:18pm:

I agree the proxy option is definitely a way to go. But would it be possible to have a solution using just Firefox? (maybe an add-on?)

+4  A: 

If you can change the endpoint URL you could bounce the requests through your local server, either with mod_rewrite or a simple script.

This has the advantage that you can easily log the requests and responses, and alter them (e.g. send back timeout errors, bad data and the like).

Greg
+1 I think this is the way to go. You could write a simple, stand-alone proxy that lets you switch 'modes' at will. For several of our projects, we had a proxy that could switch between 'normal', 'slow', 'timeout', etc from a simple command line interface.
Outlaw Programmer
I agree the proxy option is definitely a way to go. But would it be possible to have a solution using just Firefox (maybe an add-on?)Actually if there is not, it could be a nice extension to try to write and might be helpful to a lot of people, something like an integrated proxy on the browser.
Javier
Although Fiddler is a stand-alone proxy, it has some sort of FF plug-in in the latest beta. Not sure if the plugin is just an on/off switch, but communicating more info wouldn't be too hard.
Piskvor
A: 

Well, for viewing the requests/stepping through the js try using Firebug.

Ali Lown
I don't think this applies here. It sounds like he can't even make the request because his development machine is on a different domain than the data provider. The browser's cross-domain restrictions keep him from ever making the request.
Outlaw Programmer
@Outlaw Programmer, that is correct. There is no request going on because of the restriction.
Javier