Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reverse engeering cross domain POST requests which use Ext.Ajax.request

I'm working with a script which seems to use Ext.Ajax.request (with ExtJS 3) to send cross-domain requests - some of them POST requests. Considerations are being made to move away from ExtJS3 (perhaps move away from ExtJS in general) but a quick attempt at using XMLHttpRequest didn't work; how can I find out what technique is being used to send those cross domain requests?

like image 901
Richard JP Le Guen Avatar asked Nov 14 '22 16:11

Richard JP Le Guen


1 Answers

I'm currently using ExtJS 3.3.1, I haven't made the switch to 4 yet but will most likely when a new project comes about. Without looking at the Ext source I can tell you they are using JSONP to accomplish this task, it is the only way to make a cross-domain AJAX call because JavaScript has to abide by the same-origin policy.

Are you trying to do a pure JS implementation of JSONP? Or are you using a JS library already?

Edit

Per our comments... they are making POST requests. That's not possible with JSONP. So as far as I can tell, they are using iframe trickery similar. It's the same trick used to "AJAX" upload files on older browsers.

This link explains it in more detail.

Also, the same method (iframe to, POST, upload a file) is used in Valum's file uploader. It's much easier to follow then the ExtJS source.

like image 187
John Strickler Avatar answered Jun 01 '23 10:06

John Strickler