Advertisement
najjah

Script para interceptar XHR

Aug 6th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function(XHR) {
  2. "use strict";
  3.  
  4. var open = XHR.prototype.open;
  5.  
  6. XHR.prototype.open = function(method, url, async, user, pass) {
  7. url = fixURL(url);
  8. open.call(this, method, url, async, user, pass);
  9. };
  10.  
  11. })(XMLHttpRequest);
  12.  
  13.  
  14. // corrije as URLs de ajax
  15. function fixURL(url) {
  16. console.log('fixURL: ', url, ' ', 'http://localhost/public/mockups_php/ajax.php?url=' + encodeURIComponent(url.replace('http://localhost', 'http://infoecedsvextra2.globoi.com')));
  17. return 'http://localhost/public/mockups_php/ajax.php?url=' + encodeURIComponent(url.replace('http://localhost', 'http://infoecedsvextra2.globoi.com'));
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement