0

I want to make a java script crawler that gets a assignment from a php server and than index the page. but the sites I want to crawl are external and I cant reach them with javascript does anyone have a solution with a other assignment language or a javascript solution.

I thought of using greasemonkey to crawl a page when a new site is loaded.

tgb
  • 91
  • 1
  • 7

2 Answers2

1

You can't reach them because of browser security restrictions- i believe this is termed cross site scripting. This is the type of job for the PHP application, not the client.

If you need the client to do the work then request same origin policy bypass permission from the client. See here stackoverflow.com:can-i-disable-sop-same-origin-policy-on-any-browser-for-development

You can achieve the same thing with a java applet.

Community
  • 1
  • 1
Mario Aguilera
  • 1,146
  • 1
  • 9
  • 16
  • I want the client to do the work. if my own server does all the work it doesn't go verry well. – tgb Mar 06 '12 at 10:14
1

jquery.xdomainajax.js is capable of loading external page.

Here is a simple code to load webpage

$(document).ready(function(){
   $('#test').load('http://abc.com', '', function(response, status, xhr) {
      if (status == 'error') {
          var msg = "Sorry but there was an error: ";
          $(".content").html(msg + xhr.status + " " + xhr.statusText);
      }
    });
}); 

It can work with cross domain.

De.
  • 99
  • 2
  • 8