Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: JavaScript to Fetch Text

__/ [Vladdy] on Tuesday 13 September 2005 00:14 \__

> Roy Schestowitz wrote:
>> <SNIP
>>
>> [CODE]
>> 
>> function showInfo()
>> {
>>  oxmlhttp =getFile('/robots.txt');
>>  document.write(oxmlhttp);
>> }
>> 
>> [/CODE]
>> 
>> but the following will not
>> 
>> 
>> [CODE]
>> 
>> function showInfo()
>> {
>>  oxmlhttp =getFile('http://example.org/robots.txt');
>>  document.write(oxmlhttp);
>> }
>> 
>> [/CODE]
>> 
>> Is there a simple way around this? The text remains 'null' if I try the
>> latter, which is why I need to access a machine of mine from the Web
>> server.
>> 
>> Thanks again,
>> 
>> Roy
>
> As I mentioned in my original post, the xmlhttp file access only works
> within the same domain - security reasons. In the first example, the
> same domain is assured by using the relative URL, in the second one, it
> may not be (for example, you may need to add "www." to match the domain
> of the page containing script; or it not work at all with the full
> domain name - I have never tried it for the aformentioned reason)

That's what I was worried about. It apparently discourages scraping, which
in this case is something I want to do benevolently -- grabbing content
from my own machine. I can think of alternative solutions involving a
grabber like wget, but that would take me too far.

Many thanks,

Roy

-- 
Roy S. Schestowitz      | "Signature pending approval"
http://Schestowitz.com  |    SuSE Linux    |     PGP-Key: 74572E8E
  3:50am  up 18 days 21:24,  3 users,  load average: 0.40, 0.65, 0.73

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index