html - Javascript, accessing nested frames in framesets from a iFrame -


i'm having issues accessing frame part of page loaded iframe. frame nested in multiple framesets.

my html looks this:

<iframe name="sourceframe" src="siteindex.html">     #document <-- appears in dom tree. not sure if it's relevant.         <html>             <head></head>             <frameset>                 ...other frames                 <frameset>                     <frame name="targetframe" src="sitesubpage.html">                         ...i want access frame , replace contents different html page...                     </frame>                 </frameset>             </frameset>         </html> </iframe> 

i have read similar questions none of have solution can work.

any suggestions appreciated.

window.frames['sourceframe'].frames['targetframe'].location.href = 'new_html_page'; 

ff , chrome have frames collection in window, ie , opera have in document. above code works (tested), when timing corrected.

try use timeout before changing the href, or trigger change #targetframe. can attach onload event listener iframe, , trigger change in it. 1 more, can place script creating iframe before closing body tag, can use window.onload change page in depths...


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -