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

  • Home
  • SEARCH
  • 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 8870123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:38:46+00:00 2026-06-14T17:38:46+00:00

I have two iframes, iframe1 and iframe2. Iframe1 has 4 links. Now when I

  • 0

I have two iframes, iframe1 and iframe2. Iframe1 has 4 links. Now when I click on the last link, I have been able to close the iframe. But on closing it, I want iframe2 to be opened without any user-initiated action. How can I achieve this ?

This is the code that I have used for closing iframe1 and then i am trying to call iframe2 like this :

EDIT :

function prepareFrame() {
alert("Inside prepare frame");
ifrm = document.createElement("IFRAME");
ifrm.setAttribute("src", "openThis.jsp");
ifrm.style.width = 640+"px";
ifrm.style.height = 480+"px";
document.body.appendChild(ifrm);
}

function closeMyIframe() {
  var parentDynamicDiv = window.parent.document.getElementById('dynamic_id1');
  var iframe = window.parent.document.getElementById('dynamic_id2');
  iframe.style.display = 'none';
  parentDynamicDiv.style.display = 'none';
  prepareFrame();
}

Here the alert inside prepareFrame() is coming up but the modal is not .

Iframe1 is sourced from a parent jsp called myJSP.jsp, so when closed, I presume the control returns to that jsp. From there on, how can I open the new iframe automatically?

Kindly help.

  • 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-06-14T17:38:47+00:00Added an answer on June 14, 2026 at 5:38 pm

    Assume your iframe1 id is dynamic_id1, iframe2 id is dynamic_id2 and your function closeMyIframe() is inside iframe1 page.

    If so, just change your code line 4, from

    iframe.style.display = 'none';
    

    to

    iframe.style.display = 'block';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two applications running on different domains: webformapp.com mvcapp.com webformapp.com has an iframe
If I have two iframes, how can I match the one that HAS NOT
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have a html document that has this structure: https://i.stack.imgur.com/zrOq1.png <- sorry for link,
I have two iframes next to each other at 50% width and am wondering
I have an iFrame which has it's source set to another aspx page. The
Okay, I have an html page with two iframes on it so. ------------------------------------------------- |
I have a page with two iframe contents which are split horizontally. The left
I have a page which has two distinct parts : a left side of
I have two websites.. (MVC applications) www.WebsiteA.com (has two tabs in it) like this..

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.