Get all url links from webpage after page is completely loaded

F

frytaz

Hi how i can get all url from page after it's completely loaded even
those links in iframe's ?
 
V

VK

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.
 
P

pr

VK said:
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;
}

[...]
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top