Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5964189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:23:11+00:00 2026-05-22T19:23:11+00:00

Ok, I have 2 iframes inside a parent page (for whatever reason). I have

  • 0

Ok, I have 2 iframes inside a parent page (for whatever reason).

I have a navigation menu on parent page, which changes the source of iframe #1…

iFrame #1’s job, is to display ANOTHER navigation menu… Like a subnavigation menu…

Now, how can I upon clicking an li inside iFrame #1, change the source of iframe #2? They’re both on the same parent page…

Aside from failing miserably, I also get a warning from Chrome’s Dev tools –

Unsafe JavaScript attempt to access frame with URL file:///C:/website/index.html from frame with URL file:///C:/website/news/navigator.html. Domains, protocols and ports must match.

Here’s some code to make things slightly clearer:

The HTML

<!-- HTML for the parent page itself -->
<iframe id="frameone" src=""></iframe>
<iframe id="frametwo" src=""></iframe>
<button onclick="onenav('test.html')">Change 1st frame</button>

<!-- The following is the HTML that is loaded inside "frameone" -->
<button onclick="twonav('test2.html')">Change 2nd frame</button>

// Javascript
var one = document.getElementById('frameone');
var two = document.getElementById('frametwo');

function onenav(x){
    one.src = x;
}

function twonav(y){
    two.src = y;
}

To me, this makes sense, since this is all being executed on the parent page… On loading, I query the dev tools and I can see that both, ‘one’ and ‘two’ have frame elements… The first button works, the second one, doesn’t…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:23:12+00:00Added an answer on May 22, 2026 at 7:23 pm

    Works for me when using parent.twonav

    DEMO

    var links = [
        'javascript:\'<button onclick="parent.twonav(1)">Change 2nd frame</button>\'',
        'javascript:\'Hello\''
    ];
    var one, two;
    window.onload=function() {
      one = document.getElementById('frameone');
      two = document.getElementById('frametwo');
    }  
    
    function onenav(idx) {
        one.src=links[idx];
    }  
    
    function twonav(idx) {
        two.src=links[idx];
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have iframe inside a page, and this iframe contain a submit button which
I have a very long iframe inside my parent page. When you reload or
I have parent page index.php and inside it i have iframe like below <div
I have a page in html (parent page) that have inside an iframe. When
I have a page with iframe. Content inside iframe does window.parent.resizeTo calls (or something
I have a page being loaded in an <iframe> . Inside the <iframe> ,
I have iframe on a page, the iframe and the parent page are in
How to exit from iframe? I have a pages called Master.aspx , Parent.aspx (inside
I have a page with an iframe. The link inside an iframe should open
I have a page which displays a different website (say www.cnn.com) in an iframe.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.