473,396 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

change the url of html document embedded inside object element.

Hi,

I'm using object element instead of iframe to embed html document.
My code:

Expand|Select|Wrap|Line Numbers
  1. <object id="childFrame" class="innerObject" classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13" type="text/html" data="index.php">  
  2.               <p>backup content</p>  
  3. </object>
  4.  
On FF the object has a contentDocument property but IE7 doesn't. How can I access the document and use location.replace for example on IE7.

Is there a tool like firebug that will let me investigate all the properties on IE?

Thanks
Jan 18 '08 #1
7 5233
acoder
16,027 Expert Mod 8TB
On FF the object has a contentDocument property but IE7 doesn't. How can I access the document and use location.replace for example on IE7.
contentDocument is for an iframe, I think, so for IE7 you'd use window.frames[frameName].document.
Is there a tool like firebug that will let me investigate all the properties on IE?
You can try using Firebug Lite.
Jan 18 '08 #2
I tried what you suggested but it replaces the main page url instead of the page inside the object.

My code:

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3.     <head>
  4.         <meta http-equiv="Content-Type" content="text/html; charset=iso-utf-8" />
  5.         <title>object test</title>
  6.         <script type="text/javascript">
  7.             var test = function() {
  8.                 var frm = window.frames['childFrame'].document.location.replace('page2.html');
  9.             }
  10.         </script> 
  11.     </head>
  12.     <body>
  13.         <object  id="childFrame" name="childFrame" type="text/html" data="page1.html" width=50% height=50%> 
  14.         </object>
  15.  
  16.         <button id="btn" onclick="test()">replace object url</button>
  17.  
  18.     </body>
  19. </html>
page1.html and page2.html are test pages:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3.     <head>
  4.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5.         <title>Demo</title>
  6.     </head>
  7.     <body>
  8.         <p>empty page</p>        
  9.     </body>
  10. </html>
Jan 18 '08 #3
acoder
16,027 Expert Mod 8TB
IE can't handle embedding pages with the object tag. In IE, the object tag can only embed plugins and applets. See this link for more information. You'll need to use an iframe.
Jan 18 '08 #4
According to this he can.
Jan 18 '08 #5
acoder
16,027 Expert Mod 8TB
According to this he can.
Oh, I see that you're trying to embed in a strict HTML page which means you can't use an iframe. Forget the suggestion earlier about window.frames because that obviously wouldn't work.

One option I can think of is to dynamically create another object and replace the old one using replaceChild().
Jan 19 '08 #6
It turned out to be simple:

Expand|Select|Wrap|Line Numbers
  1. objectName.object.body
Now I'm dealing with another problem.
When a user navigate inside the inner page it makes new entries in the browser history. I guess I can't prevent that from happening.

When the user clicks on the back/forward browser history buttons the right page appears but the object tag is being reloaded.

On FF it works fine.

Any idea how to prevent it from reloading on IE?

Thanks
Jan 20 '08 #7
acoder
16,027 Expert Mod 8TB
Good work on figuring out the solution to the other problem.
Now I'm dealing with another problem.
When a user navigate inside the inner page it makes new entries in the browser history. I guess I can't prevent that from happening.

When the user clicks on the back/forward browser history buttons the right page appears but the object tag is being reloaded.

On FF it works fine.

Any idea how to prevent it from reloading on IE?
This may be normal behaviour (in IE), though I'm not sure. I don't think it's possible to change this, though I'd be happy to be corrected.
Jan 21 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: google | last post by:
I have a HTML file that contains an iframe. The HTML file is served by one server. The iframe contains a link to a completely different server. My question is, can any action in the iframe (such...
6
by: Moist | last post by:
Hi, I have an embedded HTML object as follows (ignore the code tag): <code> <object id="page" data="table.html" type="text/html" .... > </code> I look for the Javascript code (placed in...
10
by: Andrew Poulos | last post by:
While this works on IE 6: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>aiff</title> <meta http-equiv="Content-Type"...
4
by: frogman042 | last post by:
My daughter is playing around trying to learn JavaScript and she wrote a small program that prints out a message in increasing and decreasing font size and color changes. She is using document...
6
by: Jon Davis | last post by:
I recently learned how to do an <OBJECT> alternative to <IFRAME> in current browsers using: <object id="extendedhtml" type="text/html" data="otherpage.html" width="250" height="400"></object> ...
16
by: graham.reeds | last post by:
I am updating a website that uses a countdown script embedded on the page. When the page is served the var's are set to how long the countdown has left in minutes and seconds, but the rest of the...
7
by: David | last post by:
Hi, I'd really appreciate any help. Im trying to change a label over and over again. I can change it the first time, by using the following code, however it never works again, how can i do this...
3
by: SMH | last post by:
Normally an SVG document is loaded/parsed/interpreted inside an HTML document using an 'object' (or 'embed') element, although there are supposedly other ways too. The problem is, the SVG document...
1
by: John L. | last post by:
How do I invoke the scroll() method of a window object for a scrollable IFRAME element in an HTML document? I am using IE 7.0, and I thought the following would work: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.