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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -