473,378 Members | 1,393 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,378 software developers and data experts.

embedded html page

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 the main document) that can reload
or refresh the object contains at will?

Thanks for any idea!
Moist


Jul 23 '05 #1
6 2290


Moist wrote:

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 the main document) that can reload
or refresh the object contains at will?


Consider using an iframe e.g.
<iframe name="iframeName" src="table.html"></iframe>
that way you can in all browsers script
window.frames.iframeName.location.reload();
Refreshing an <object> is difficult across browsers, recent Opera and
Netscape/Mozilla version allow you to access the contentDocument
property of the HTMLObjectElement element object and then you can access
the defaultView and from there the location object:

<object id="object1"
type="text/html"
data="test2004090402.html">
width="200" height="200"></object>
<input type="button" value="refresh"
onclick="var object = document.getElementById('object1');
if (object.contentDocument &&
object.contentDocument.defaultView &&
object.contentDocument.defaultView.location) {
object.contentDocument.defaultView.location.reload ();
}">
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

"Martin Honnen" <ma*******@yahoo.de> a écrit dans le message de news:
41***********************@newsread4.arcor-online.net...


Moist wrote:

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 the main document) that can
reload or refresh the object contains at will?
Consider using an iframe e.g.
<iframe name="iframeName" src="table.html"></iframe>
that way you can in all browsers script
window.frames.iframeName.location.reload();
Refreshing an <object> is difficult across browsers, recent Opera and
Netscape/Mozilla version allow you to access the contentDocument property
of the HTMLObjectElement element object and then you can access the
defaultView and from there the location object:

<object id="object1"
type="text/html"
data="test2004090402.html">
width="200" height="200"></object>
<input type="button" value="refresh"
onclick="var object = document.getElementById('object1');
if (object.contentDocument &&
object.contentDocument.defaultView &&
object.contentDocument.defaultView.location) {
object.contentDocument.defaultView.location.reload ();
}">


Thanks for this info!
Frames is probably the simplest solution. But do you know if IE can access
embedded objects in a HTML page, or at least reload them. I've searched in
MSDN library with no success so far, I didn't see any methods that can do
that. May there is none... :(


Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3


Moist wrote:
"Martin Honnen" <ma*******@yahoo.de> a écrit dans le message de news:
41***********************@newsread4.arcor-online.net...

Moist wrote:
I have an embedded HTML object as follows (ignore the code tag):

<code>
<object id="page" data="table.html" type="text/html" .... >
</code>
But do you know if IE can access
embedded objects in a HTML page, or at least reload them.


IE can access the object elemens the same way as other elements, e.g.
var page;
if (document.getElementById) {
page = document.getElementById('page');
alert(page.data);
}
but in my tests it refuses to change the loaded data if you reassign to
the data property.
I haven't found a way to access the document inside of an embedded
<object> element with IE.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4
>>>>I have an embedded HTML object as follows (ignore the code tag):

<code>
<object id="page" data="table.html" type="text/html" .... >
</code>
But do you know if IE can access embedded objects in a HTML page, or at
least reload them.


IE can access the object elemens the same way as other elements, e.g.
var page;
if (document.getElementById) {
page = document.getElementById('page');
alert(page.data);
}
but in my tests it refuses to change the loaded data if you reassign to
the data property.
I haven't found a way to access the document inside of an embedded
<object> element with IE.


Using your code and trying 'location.href' instead, it seems to work:

object = document.getElementById('table');
object.location.href = "c:\\table.html";

It reloads the page I wanted to. However, as you said, accessing elements in
that page remains to be seen...

Moist
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #5

"Moist" <a@b.com> a écrit dans le message de news:
iz******************@weber.videotron.net...
>I have an embedded HTML object as follows (ignore the code tag):
>
><code>
> <object id="page" data="table.html" type="text/html" .... >
></code>
>
But do you know if IE can access embedded objects in a HTML page, or at
least reload them.


IE can access the object elemens the same way as other elements, e.g.
var page;
if (document.getElementById) {
page = document.getElementById('page');
alert(page.data);
}
but in my tests it refuses to change the loaded data if you reassign to
the data property.
I haven't found a way to access the document inside of an embedded
<object> element with IE.


Using your code and trying 'location.href' instead, it seems to work:

object = document.getElementById('table');
object.location.href = "c:\\table.html";

It reloads the page I wanted to. However, as you said, accessing elements
in that page remains to be seen...

Moist


I discovered even simpler, just by using the name of the object directly:

table.location.href = "c:\\table.html";

Moist
--

Martin Honnen
http://JavaScript.FAQTs.com/


Jul 23 '05 #6
On Sun, 5 Sep 2004 13:01:28 -0400, Moist <a@b.com> wrote:

[snip]

Please trim quoted text that doesn't apply to your post.
I discovered even simpler, just by using the name of the object directly:

table.location.href = "c:\\table.html";


It will work in IE, but it is unlikely to work in other browsers. See:

<URL:http://jibbering.com/faq/#FAQ4_41>

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Aquarius2431 | last post by:
Hi!, I don't think I have posted to this group before. Have been using PHP on my webserver for a few months now and finding that I like it quite a bit. Here is a question that just occurred...
2
by: Rick | last post by:
Hi.. I've got some code I wrote in PHP that will generate an HTML page with embedded javascript which in turn creates a new argument string for the browser, but the xhtml parser in Firefox and...
0
by: ATS | last post by:
HOWTO Make a UserControl deploy an embedded resource. Please help, I need to embed an EXE into a C# UserControl that is run from script in an HTML web page as such: <html> <object...
2
by: FishingScout | last post by:
I have a small html file that I have added to my project. When I added "sample.html", I set the build action to "embedded resource". In the application I would like to do something like this (...
2
by: Owen.Leibman | last post by:
Here is a complete web page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <html> <head> <title>Javascript Embed and onunload</title> <script type="text/javascript"> function useplayer() {...
1
by: jmc | last post by:
The short version: Is there a way to get embedded styles to work on files that are displayed in a page using the shtml Include method? My work intranet site uses Front Page dynamic templates. ...
2
Frinavale
by: Frinavale | last post by:
I am attempting to use embedded resources in an Ajax Enabled ASP.NET Web Application. I'm using Visual Studio 2008 and VB.NET server side code. The project is called "EmbeddedResources" with the...
6
by: LEM | last post by:
Hi, I use a Webbrowser component to display a page that has been generate dynamically from my C# program. This page contains some images that are displayed using HTML code like this: <img...
1
by: humtum | last post by:
Greetings Everyone! I am working on a Java application where I have to develop a Swings client which talks to a web-server. The client sends the HTTP get request for a specific resource which it...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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...

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.