Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Get all url links from webpage after page is completely loaded

Reply
Thread Tools

Get all url links from webpage after page is completely loaded

 
 
frytaz@gmail.com
Guest
Posts: n/a
 
      01-26-2008
Hi how i can get all url from page after it's completely loaded even
those links in iframe's ?
 
Reply With Quote
 
 
 
 
VK
Guest
Posts: n/a
 
      01-26-2008
On Jan 26, 8:07 pm, "(E-Mail Removed)" <(E-Mail Removed)> 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[i] = win.document.links[i].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.
 
Reply With Quote
 
 
 
 
pr
Guest
Posts: n/a
 
      01-27-2008
VK wrote:
> On Jan 26, 8:07 pm, "(E-Mail Removed)" <(E-Mail Removed)> 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[i] = win.document.links[i].href;
> }
> return lnk;
> }

[...]
 
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
Re: VOIPfone down completely ... I mean very completely !! cjd UK VOIP 2 10-10-2008 01:17 PM
Ruby\Watir Hangs if the browser is not loaded completely Vishwanath Uppala Ruby 2 11-21-2007 11:40 AM
How to extract all link from web page (loaded in variable $content) to scalar @links? Perl Misc 2 09-11-2006 05:14 PM
PAGE LINKS/BUTTONS WON'T WORK UNTIL PAGE FULLY LOADED Fenno ASP .Net 0 11-06-2005 06:02 AM
I want to know whether a url opened is loaded completely ngashok@gmail.com Javascript 1 07-07-2005 02:00 PM



Advertisments