Javascript to get entire contents of frame -
i want have script rewrite simple text-file opened source of frame -- 1 lacks html. tried frames[1].document.innerhtml
without success. tried .outerhtml
, got nothing. can either (a) frame entire contents of frame manipulate using script , .write()
result frame? or (b) add <html>
, <div>
tags, wrapping document can inner html , manipulate that? appreciated.
as long main page , iframe page follow same origin policy, can access frame's html this:
window.frames['iframe01'].document.body.innerhtml
or
window.frames['iframe01'].contentdocument.documentelement.innerhtml
to write:
window.frames['iframe01'].contentdocument.write("[content here]");
Comments
Post a Comment