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

The Archive Base Latest Questions

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

I have an HTML page which contains an Object tag to host an embedded

  • 0

I have an HTML page which contains an Object tag to host an embedded HTML page.

<object style='border: none;' standby='loading' id='contentarea'   width='100%' height='53%' type='text/html' data='test1.html'></object> 

However, I need to be to change the HTML page within the object tag. The current code seems to create a clone of the object and replaces the existing object with it, like so:

function changeObjectUrl(newUrl) {     var oContentArea = document.getElementById('contentarea');     var oClone = oContentArea.cloneNode(true);      oClone.data = newUrl;       var oPlaceHolder = document.getElementById('contentholder');      oPlaceHolder.removeChild(oContentArea);      oPlaceHolder.appendChild(oClone);  } 

This seems a rather poor way of doing this. Does anyone know the ‘correct’ way of changing the embedded page?

Thanks!

EDIT: In response to answers below, here is the full source for the page I am now using. Using the setAttribute does not seem to change the content of the Object tag.

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'> <html> <head> <title>Test</title> <script language='JavaScript'> function doPage() {     var objTag = document.getElementById('contentarea');     if (objTag != null)     {         objTag.setAttribute('data', 'Test2.html');         alert('Page should have been changed');     } } </script> </head> <body> <form name='Form1' method='POST'> <p><input type='button' value='Click to change page' onclick='doPage();' /></p> <object style='visibility: visible; border: none;' standby='loading data' id='contentarea' title='loading' width='100%' height='53%' type='text/html' data='test1.html'></object> </form> </body> </html> 

The Test1.html and Test2.html pages are just simple HTML pages displaying the text ‘Test1’ and ‘Test2’ respectively.

  • 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. 2026-05-11T14:22:02+00:00Added an answer on May 11, 2026 at 2:22 pm

    Here’s how I finally achieved it. You can do

    document.getElementById('contentarea').object.location.href = url; 

    or maybe

    document.getElementById('contentarea').object.parentWindow.navigate(url); 

    The Object element also has a ‘readyState’ property which can be used to check whether the contained page is ‘loading’ or ‘complete’.

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

Sidebar

Related Questions

I have an HTML page (say welcome.html) which contains an iframe to a page
I have this html page which is very simple, it contains a text box
I have a page which contains a html.RenderPartial, that renders an ASP.NET MVC partial
I have a html page which contains nested frameset (don't ask why, I'm only
If I have a page which contains an iframe: <iframe src=blank.html id=frame></iframe> and I
I have a page which contains several vimeo videos, embedded in the standard iframe
In JavaScript, let's say we have a main page ( main.html ) which contains
Hey, I have a html page which contains for example the following tags :
So, I have my Node.js script. And I have some HTML page which contains
We have an HTML page which displays a bunch of pretty bars using divs

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.