-1

I include jQuery in my site with Google CDN:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>

All works as expected, but when I try to access it with any web proxy online such as Zend2 or Proxify, then jQuery cannot be loaded. Depending on which jQuery version is included and the web proxy used, we get various error messages in the browser console when the browser tries to parse jquery.min (var is undefined, etc).

All sites using jQuery, including jQuery's site itself, have the same issue. For example try to use the jQuery UI demo site through a web proxy: the jQuery UI widgets can't be used, see all error messages in your web console.

I tried dozens of proxies, I only found one wich is miraculously able to parse jQuery.

Why jQuery does not work with most of these web proxies? Is there any workaround? Thanks!

Glenn Slaven
  • 33,720
  • 26
  • 113
  • 165
Dominique
  • 4,272
  • 1
  • 16
  • 21

1 Answers1

0

Both those proxies remove scripts by default. There's nothing in jquery.min.js except scripts. Make sure you turn off the "Remove scripts" option before using the proxies.

I downloaded jquery.js (non-minified) with and without the proxy, and diff'ed them. It makes lots of changes to the code. Some of them are just syntactic changes that I don't think should have any impact, but there are lots like this:

location = window.location,

becomes:

location =  _proxy_jslib_handle(window, 'location', '', 0, 0),

They all involve _proxy_jslib_XXX functions that replace various built-in Javascript mechanisms. I googled this and found that it comes from CGIProxy, a script used by most proxy sites. Maybe the changes it makes aren't fully compatible with jquery.

Probably the right place for you to raise this is his web site. It's not really a programming problem appropriate for SO.

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • Thanks Barmar, but obviously i turned off "remove scripts" option on more than 30 web proxies and it does not work. You can easily try this with any jquery website. Furthermore, jquery.min is included through a proxy, not removed, but for an unknown reason it cannot be parsed. – Dominique Oct 06 '12 at 18:12
  • Thank you Barmar for this update, i did not realize these proxies had to "proxify" javascript libraries as well, and applying this kind of change on the fly. I mailed this issue to the CGIProxy developper. – Dominique Oct 07 '12 at 10:34