In comp.lang.javascript message <ce31d781-32e1-459e-bc99-989eba296ed1@h9
g2000vbr.googlegroups.com>, Fri, 2 Sep 2011 09:25:04, John L.
Is it possible to access the HTML source of a page that is loaded in
an IFRAME via JavaScript in the top-level page?
Yes.
See the code for <
http://www.merlyn.demon.co.uk/linxchek.htm>. Note
that only a local copy of the page can be run, since I don't want others
to waste my bandwidth on checking my links.
IIRC, the inner page must be from the same domain as the outer; and when
using Chrome after about version 5 they cannot be local files (they
probably can be from a local server).
FYI, here's a pane of possible results of that page (the 4 bad dates are
test cases for the bad date tester):-
Consolidation :
..
.. Targets missing : 0
.. Anchors not used : 0
.. Anchors repeated : 0
.. ID dupes Target : 0
.. FolderMissing - Linked and Missing, 0 cites of 0 places
.. LinkedMissing - Linked and Missing, 0 cites of 0 places
.. Date_Problems - Bad Date / Bad Day, 4 cites of 4 places
..
.. Unlike8point3 - Vexing Name Format, 28 cites of 5 places
.. Domains_Cited - Domains Linked For, 2805 cites of 1059 places
.. LocalOutLinks - X-site Local Files, 65 cites of 46 places
.. AllLocalLinks - Local Files Linked, 11555 cites of 3896 places
.. AllLocalFiles - Total Files Linked, 11555 cites of 446 places
.. FolderPresent - Linked and Present, 25 cites of 4 places
.. LinkedPresent - Linked and Present, 11465 cites of 396 places
.. All_LinkTexts - All Texts of Links, 14077 cites of 6265 places
.. SrcAttributes - 'SRC=' Attributes, 425 cites of 85 places
.. Anchors sighted : 3292
.. IDs sighted : 785
.. SRCs sighted : 425
.. Links, total : 14078
.. Links, other : 2948
.. Protocols : c: 1, file: 11555, ftp: 109, http: 2658, https: 36,
javascript: 5, mailto: 4, 116, view-source: 19
.. Extensions : awk 1, bat 8, bmp 1, css 7, exe 8, gif 230, htm 10546,
jpg 11, js 237, null 1, pas 127, pl 1, png 8, shtml 15, txt 194, xhtml
2, zip 68
.. Time taken : 68536 ms.