Get all url links from webpage after page is completely loaded

Discussion in 'Javascript' started by frytaz@gmail.com, Jan 26, 2008.

  1. Guest

    Hi how i can get all url from page after it's completely loaded even
    those links in iframe's ?
    , Jan 26, 2008
    #1
    1. Advertising

  2. VK Guest

    On Jan 26, 8:07 pm, "" <> wrote:
    > Hi how i can get all url from page after it's completely loaded even
    > those links in iframe's ?


    for all links in document:

    function getAllLinkUrl(win) {
    var lnk = new Array();
    var len = win.document.links;
    for (var i=0; i<len; i++) {
    lnk = win.document.links.href;
    }
    return lnk;
    }

    respectively to get array of all link URLs from the main page,

    var links = getAllLinksUrl(window.self);

    to get all links from the first iframe,

    var links = getAllLinksUrl(window.frames[0]);

    I'm leaving as an exercise to you to make it for N amount of iframes
    on the page (if you need it).

    Be aware that you can access iframe content only if both the parent
    page and iframe are from exactly the same domain. Otherwise the access
    will be denied and no, you cannot change that.
    VK, Jan 26, 2008
    #2
    1. Advertising

  3. pr Guest

    VK wrote:
    > On Jan 26, 8:07 pm, "" <> wrote:
    >> Hi how i can get all url from page after it's completely loaded even
    >> those links in iframe's ?

    >
    > for all links in document:
    >
    > function getAllLinkUrl(win) {
    > var lnk = new Array();
    > var len = win.document.links;


    You mean

    var len = win.document.links.length;

    > for (var i=0; i<len; i++) {
    > lnk = win.document.links.href;
    > }
    > return lnk;
    > }

    [...]
    pr, Jan 27, 2008
    #3
    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. Vishwanath Uppala
    Replies:
    2
    Views:
    100
    Vishwanath Uppala
    Nov 21, 2007
  2. Math55
    Replies:
    2
    Views:
    100
    John W. Krahn
    Jul 4, 2003
  3. Mark
    Replies:
    4
    Views:
    109
    Java script Dude
    Aug 5, 2004
  4. Guest
    Replies:
    2
    Views:
    163
    Vasiliy Litovchenko
    Sep 11, 2006
  5. Replies:
    1
    Views:
    87
Loading...

Share This Page