Reading and interpreting data from web page

Discussion in 'Javascript' started by royg567, Feb 19, 2011.

  1. royg567

    royg567 Guest

    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.
     
    royg567, Feb 19, 2011
    #1
    1. Advertising

  2. royg567

    Martie Guest

    On 19 feb, 15:53, 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.


    Something like this:

    javascript:eek:utText='';for(i=0;i<document.links.length;i++)
    {if(outText.in
    dexOf(document.links)==-1){outText+='<tr><td><a
    href='+document.links+'>'+document.links+'</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:

    javascript:eek:utText='';for(i=0;i<document.images.length;i++)
    {with(documen
    t.images){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
     
    Martie, Feb 20, 2011
    #2
    1. Advertising

  3. royg567

    Martie Guest

    On 19 feb, 15:53, 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.
    Then paste 1 of these javascript lines i the adress-bar and press
    [Enter].
     
    Martie, Feb 20, 2011
    #3
  4. 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$> (2004)
     
    Thomas 'PointedEars' Lahn, Feb 20, 2011
    #4
  5. Martie wrote:

    > On 19 feb, 15:53, 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.

    >
    > Something like this:
    >
    > javascript:eek:utText='';for(i=0;i<document.links.length;i++)
    > {if(outText.in
    > dexOf(document.links)==-1){outText+='<tr><td><a
    > href='+document.links+'>'+document.links+'</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:
    >
    > javascript:eek:utText='';for(i=0;i<document.images.length;i++)
    > {with(documen
    > t.images){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
     
    Thomas 'PointedEars' Lahn, Feb 20, 2011
    #5
  6. 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.)
     
    Thomas 'PointedEars' Lahn, Feb 20, 2011
    #6
  7. royg567

    Alter Ego Guest

    "Thomas 'PointedEars' Lahn" <> wrote in message
    news:...
    > 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
     
    Alter Ego, Feb 20, 2011
    #7
  8. royg567

    Martie Guest

    On 20 feb, 11:40, 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).
    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.)
     
    Martie, Feb 20, 2011
    #8
  9. 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.)
     
    Thomas 'PointedEars' Lahn, Feb 20, 2011
    #9
  10. In comp.lang.javascript message <01b1f7ee-0cf1-43a7-b3a7-9b97a5c90259@f3
    0g2000yqa.googlegroups.com>, Sat, 19 Feb 2011 06:53:55, royg567
    <> 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)
     
    Dr J R Stockton, Feb 20, 2011
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Meade

    Interpreting the error message?

    Rob Meade, Jan 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    392
    Rob Meade
    Jan 28, 2004
  2. =?Utf-8?B?QWxleCBNYWdoZW4=?=

    Pre-Interpreting a Request

    =?Utf-8?B?QWxleCBNYWdoZW4=?=, Nov 14, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    323
    John Saunders
    Nov 14, 2004
  3. yzzzzz

    Interpreting JSP code

    yzzzzz, Apr 19, 2005, in forum: Java
    Replies:
    4
    Views:
    544
    Tom Arne Orthe
    Apr 21, 2005
  4. JDS
    Replies:
    10
    Views:
    1,049
    Alan J. Flavell
    Feb 24, 2006
  5. RichardOnRails
    Replies:
    2
    Views:
    99
    Phrogz
    Nov 22, 2007
Loading...

Share This Page