views:

32

answers:

1

I am adept in Ruby WWW::Mechanize. And I was wondering if a jQuery equilavent exists ?

A: 

There's not really an equivalent of this because of what it does. Mechanize going to various sites, the very basic requirement for what it does simply isn't allowed in JavaScript for security reasons. Making cross-domain requests is blocked by something called the same-origin policy.

You can't make requests (and get the data back, through the request gets there) from a domain different than the one of the page you're on, this is to prevent malicious JavaScript from doing things like spam https://mybank.com with login attempts, among many other examples.

If you want something besides Mechanize for your needs, you'll have to either customize a browser and kill the SOP security, or look outside the browser like you're already doing...but since the policies are there by default, I don't believe any JS framework like this exists (that I've ever seen/heard of anyway).

Nick Craver