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 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

Ask A Question

Stats

  • Questions 272k
  • Answers 272k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Run a console/shell command to unzip the file. Or Use… May 13, 2026 at 1:53 pm
  • Editorial Team
    Editorial Team added an answer Take a look at Clang. (See http://clang.llvm.org/features.html#applications .) May 13, 2026 at 1:53 pm
  • Editorial Team
    Editorial Team added an answer What if the string you're specifying contains EOD? You can… May 13, 2026 at 1:53 pm

Related Questions

Using Deepzoom Composer creates a nice ClientBin and a nice HTML page that works
(Scroll down to bottom of post to find solution.) Got a asp.net page which
I have created an ActiveX dll using VB6 and packaged it using the Package
I have an ActiveX control (an OCX file) which raises an event. I want

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.