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 6662961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:26:50+00:00 2026-05-26T02:26:50+00:00

so, I use an iframe like this: <iframe src=script.php></iframe> (with other attributes of course).

  • 0

so, I use an iframe like this: <iframe src="script.php"></iframe> (with other attributes of course).

Now, what I am trying to do, is that the script.php does some things, than outputs a JS script, which should change that SRC attribue of the iframe to some other page.

Is that possible?

  • 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-26T02:26:50+00:00Added an answer on May 26, 2026 at 2:26 am

    Assume only one frame, without id or name:

    document.getElementsByTagName("iframe")[0].src = "http://new.url";
    

    If the current frame location is at the same domain:

    frames[0].location.href = "http://new.url";
    

    If you have multiple frames, it’s very wise to attach an ID to it. When you want to access the frame through the frames object, set a name:

    <iframe id="myframe" name="a_frame_name" src="script.page"></iframe>
    
    JavaScript:
    document.getElementById("myframe").src = "newpage.php";
    frames.a_frame_name.location.href = "newpage.php";
    frames["a_frame_name"].location.href = "newpage.php";
    

    Note: frames[..].location.href can only be changed if the main page and the frame’s location are at the same host, due to the Same Origin policy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use a site that looks like this: ... <body> <iframe src=blabla/blabla...></iframe> </body> ...
I have an IFrame app, and I would like to use some Connect features
If I have something like this: <p>Element<p> <iframe src = otherPage.html style = width:100%;height:100%>
The code for the iframe goes like this since I'm using prettyPhoto <a href=stories/story1txt.php?iframe=true&width=400&height=200
I have an iframe to embed audio which points to a src like this...
I would use an expression like this $(a[href*='2']).offset().left but for iframe's elements ... I
I use tiny_mce as word-like editor in textareas that are in iframes. I want
This is a great big mess... I know I could use an iframe, but
I have created an iframe code that I want people to use as a
I'm trying to use an <iframe> to point to an .aspx file, but when

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.