Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Reading and interpreting data from web page

Reply
Thread Tools

Reading and interpreting data from web page

 
 
royg567
Guest
Posts: n/a
 
      02-19-2011
Can anyone advise how to read data from a web page using javascript ?
I am reasonably adept at programming in a number of languages. My
ultimate goal is to read a web page on which there are a number of
links to subordinate pages, each of which contains a table with data
which I would like to process.
 
Reply With Quote
 
 
 
 
Martie
Guest
Posts: n/a
 
      02-20-2011
On 19 feb, 15:53, royg567 <(E-Mail Removed)> wrote:
> Can anyone advise how to read data from a web page using javascript ?
> I am reasonably adept at programming in a number of languages. My
> ultimate goal is to read a web page on which there are a number of
> links to subordinate pages, each of which contains a table with data
> which I would like to process.


Something like this:

javascriptutText='';for(i=0;i<document.links.len gth;i++)
{if(outText.in
dexOf(document.links[i])==-1){outText+='<tr><td><a
href='+document.links[i]+'>'+document.links[i]+'</a></td></
tr>';}};if(ou
tText!='')
{imgWindow=window.open('','linkWin','');imgWindow. document.wri
te('<table border=1
cellpadding=10><tr><th>URL</th></tr>'+outText+'</
table>');imgWindow.docu
ment.close();}else{alert('No Links!')}

and/or:

javascriptutText='';for(i=0;i<document.images.le ngth;i++)
{with(documen
t.images[i]){if(outText.indexOf(src)==-1){outText+='<tr><td><img
src='+src+'></td><td>'+height+'</td><td>'+width+'</td><td>'+src+'</
td></
tr>';}}};if(outText!='')
{imgWindow=window.open('','imgWin','');imgWindow
..document.write('<table border=1
cellpadding=10><tr><th>Image</th><th>height</th><th>Width</th><th>URL</
t
h></tr>'+outText+'</table>');imgWindow.document.close();}
else{alert('No
Images!')}

??

Greetings
 
Reply With Quote
 
 
 
 
Martie
Guest
Posts: n/a
 
      02-20-2011
On 19 feb, 15:53, royg567 <(E-Mail Removed)> wrote:
> Can anyone advise how to read data from a web page using javascript ?
> I am reasonably adept at programming in a number of languages. My
> ultimate goal is to read a web page on which there are a number of
> links to subordinate pages, each of which contains a table with data
> which I would like to process.


Open your requested page in the browser.
Then paste 1 of these javascript lines i the adress-bar and press
[Enter].
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      02-20-2011
royg567 wrote:

> Can anyone advise how to read data from a web page using javascript ?


No, because there is no "javascript". <http://PointedEars.de/es-matrix>

> I am reasonably adept at programming in a number of languages. My
> ultimate goal is to read a web page on which there are a number of
> links to subordinate pages, each of which contains a table with data
> which I would like to process.


Google for "document.links" and "XMLHttpRequest". And read the
<http://jibbering.com/faq/>.


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$(E-Mail Removed)> (2004)
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      02-20-2011
Martie wrote:

> On 19 feb, 15:53, royg567 <(E-Mail Removed)> wrote:
>> Can anyone advise how to read data from a web page using javascript ?
>> I am reasonably adept at programming in a number of languages. My
>> ultimate goal is to read a web page on which there are a number of
>> links to subordinate pages, each of which contains a table with data
>> which I would like to process.

>
> Something like this:
>
> javascriptutText='';for(i=0;i<document.links.len gth;i++)
> {if(outText.in
> dexOf(document.links[i])==-1){outText+='<tr><td><a
> href='+document.links[i]+'>'+document.links[i]+'</a></td></
> tr>';}};if(ou
> tText!='')
> {imgWindow=window.open('','linkWin','');imgWindow. document.wri
> te('<table border=1
> cellpadding=10><tr><th>URL</th></tr>'+outText+'</
> table>');imgWindow.docu
> ment.close();}else{alert('No Links!')}
>
> and/or:
>
> javascriptutText='';for(i=0;i<document.images.le ngth;i++)
> {with(documen
> t.images[i]){if(outText.indexOf(src)==-1){outText+='<tr><td><img
> src='+src+'></td><td>'+height+'</td><td>'+width+'</td><td>'+src+'</
> td></
> tr>';}}};if(outText!='')
> {imgWindow=window.open('','imgWin','');imgWindow
> .document.write('<table border=1
> cellpadding=10><tr><th>Image</th><th>height</th><th>Width</th><th>URL</
> t
> h></tr>'+outText+'</table>');imgWindow.document.close();}
> else{alert('No
> Images!')}
>
> ??


No. Please don't.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      02-20-2011
Martie wrote:

> royg567 wrote:
>> Can anyone advise how to read data from a web page using javascript ?
>> I am reasonably adept at programming in a number of languages. My
>> ultimate goal is to read a web page on which there are a number of
>> links to subordinate pages, each of which contains a table with data
>> which I would like to process.

>
> Open your requested page in the browser.


So that would not include the most recent version of Konqueror …

[x] You only know Microsoft Internet Explorer.

> Then paste 1 of these javascript lines i the adress-bar and press
> [Enter].


No, don't.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
 
Reply With Quote
 
Alter Ego
Guest
Posts: n/a
 
      02-20-2011
"Thomas 'PointedEars' Lahn" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> royg567 wrote:
>
>> Can anyone advise how to read data from a web page using javascript ?

>
> No, because there is no "javascript". <http://PointedEars.de/es-matrix>


I am such a Troll and an Attention Whore. My participation is irrelevant.

--
Thomas' Alter Ego

 
Reply With Quote
 
Martie
Guest
Posts: n/a
 
      02-20-2011
On 20 feb, 11:40, Thomas 'PointedEars' Lahn <(E-Mail Removed)>
wrote:
> Martie wrote:
> > royg567 wrote:
> >> Can anyone advise how to read data from a web page using javascript ?
> >> I am reasonably adept at programming in a number of languages. My
> >> ultimate goal is to read a web page on which there are a number of
> >> links to subordinate pages, each of which contains a table with data
> >> which I would like to process.

>
> > Open your requested page in the browser.

>
> So that would not include the most recent version of Konqueror
>
> [x] You only know Microsoft Internet Explorer.

I'm not using Micro$oft Internet Exploder, i'm using Safari (version
5.0.3) as the browser (it works here).
I't is a one-line Javascript program (created in 2003), it should also
work in Konqueror i think.
But yes, it would work in Micro$oft Internet Exploder as well (as
everything will work in it, even things that should NOT be working).
>
> > Then paste 1 of these javascript lines i the adress-bar and press
> > [Enter].

>
> No, don't.
>
> PointedEars
> --
> Use any version of Microsoft Frontpage to create your site.
> (This won't prevent people from viewing your source, but no one
> will want to steal it.)
> * -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)


 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      02-20-2011
Martie wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Martie wrote:
>> > royg567 wrote:
>> >> Can anyone advise how to read data from a web page using javascript ?
>> >> I am reasonably adept at programming in a number of languages. My
>> >> ultimate goal is to read a web page on which there are a number of
>> >> links to subordinate pages, each of which contains a table with data
>> >> which I would like to process.

>>
>> > Open your requested page in the browser.

>>
>> So that would not include the most recent version of Konqueror …
>>
>> [x] You only know Microsoft Internet Explorer.

> I'm not using Micro$oft Internet Exploder, i'm using Safari (version
> 5.0.3) as the browser (it works here).


So at least you know that there is more than one browser. And that did not
make you think?

> I't is a one-line Javascript program (created in 2003),


There is no "Javascript". The ECMAScript implementation that Safari
supports could only reasonably be named JavaScriptCore, after its script
engine. But that is only what Safari supports.

> it should also work in Konqueror i think.


Konqueror does not support `javascript:' URIs in the Address Bar to date. If
it would, using your code verbatim would have the same undesired side-
effects as in other browsers, assuming the script worked as designed.

> But yes, it would work in Micro$oft Internet Exploder as well (as
> everything will work in it, even things that should NOT be working).


There are so many things wrong with that piece of code that I do not know
where to begin. It is very unlikely that it works reliably outside of the
one tested browser version. Do not use it, and learn programming first.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
 
Reply With Quote
 
Dr J R Stockton
Guest
Posts: n/a
 
      02-20-2011
In comp.lang.javascript message <01b1f7ee-0cf1-43a7-b3a7-9b97a5c90259@f3
0g2000yqa.googlegroups.com>, Sat, 19 Feb 2011 06:53:55, royg567
<(E-Mail Removed)> posted:

>Can anyone advise how to read data from a web page using javascript ?
>I am reasonably adept at programming in a number of languages. My
>ultimate goal is to read a web page on which there are a number of
>links to subordinate pages, each of which contains a table with data
>which I would like to process.


You can, at least, read it into an iframe, as I do in my linxchek.htm,
js-grphx.htm, pageindx.htm sitedata.htm (approximate decreasing order of
complexity).

Be warned, though, that JavaScript in a web browser should only read
pages from the same domain, and some browsers either do not like
implicit file: protocols or have peculiar ideas on what then constitutes
a domain.

You can, I think, do more by putting the script in an HTA or executing
JScript with WSH.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interpreting "(.*?)" and "(?:\d+ [.]?)" in REs RichardOnRails Ruby 2 11-22-2007 04:02 AM
Interpreting Web statistics JDS HTML 10 02-24-2006 09:28 PM
Interpreting JSP code yzzzzz Java 4 04-21-2005 08:51 AM
Pre-Interpreting a Request =?Utf-8?B?QWxleCBNYWdoZW4=?= ASP .Net 3 11-14-2004 11:59 PM
Interpreting the error message? Rob Meade ASP .Net 2 01-28-2004 08:52 AM



Advertisments