Skip to main content

Posts

Showing posts from May, 2011

Cool solution for Cross domain

Just follow these steps to make it work: Compose your response as an JSON let say responseObject variable represent this JSON string/object Wrap the JSON response as an argument to a method call e.g. helloMethod (responseObject); where helloMethod is the method name Define this method( helloMethod ) which handles this response in the client side Lets take complete working sample: assume JSON Object as str = {"user":{"fname":"subodh","lname":"gupta","type":"blog","category":"tech"}} handleUser(str); function handleUser(str){ alert(str.user.fname);} just to complete the solution look at call below: jQuery.getJSON("http://subodh.blog.com/servlet?user=subodh&responseType=JSON", function(str) {     alert(str.user.fname); }); Look at this link for details jQuery.getJSON . http://subodh.blog.com/servlet?user=subodh&responseType=JSON this could be replaced by your serv...

Problem/Limitation in using flXHR

I had a cross domain issue and after browsing for a while i came across flXHR which seemed to be promising solution and hence i went ahead with it. It's a flash based cross domain solution which is based on a crossdomain.xml config file (which lists the list of sites from where you can access the services). For more details on flXHR click here. I thought I have the great solution in hand and work with it before I encountered thee major of limitation of flXHR:  The location of crossdomain.xml can be specified in configuration of flproxy via loadPolicyURL attribute. Which is supposedly the path flXHR will take to resolve the permission of your domain to access service hosted at that domain. However this is where the problem comes it will not only consider the crossdomain.xml at given location but it will also make a query at the root of the site and hunt gain for crossdomain.xml to see the permission for the client domain to access the service e.g. if you specify loadPolicyURL=ww...