embedded html page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Moist

    #1

    embedded html page

    Hi,

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

    <code>
    <object id="page" data="table.htm l" 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




  • Martin Honnen

    #2
    Re: embedded html page



    Moist wrote:

    [color=blue]
    > I have an embedded HTML object as follows (ignore the code tag):
    >
    > <code>
    > <object id="page" data="table.htm l" 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?[/color]

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

    <object id="object1"
    type="text/html"
    data="test20040 90402.html">
    width="200" height="200"></object>
    <input type="button" value="refresh"
    onclick="var object = document.getEle mentById('objec t1');
    if (object.content Document &&
    object.contentD ocument.default View &&
    object.contentD ocument.default View.location) {
    object.contentD ocument.default View.location.r eload();
    }">
    --

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

    Comment

    • Moist

      #3
      Re: embedded html page


      "Martin Honnen" <mahotrash@yaho o.de> a écrit dans le message de news:
      4139d29e$0$2846 2$9b4e6d93@news read4.arcor-online.net...[color=blue]
      >
      >
      > Moist wrote:
      >
      >[color=green]
      >> I have an embedded HTML object as follows (ignore the code tag):
      >>
      >> <code>
      >> <object id="page" data="table.htm l" 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?[/color]
      >
      > Consider using an iframe e.g.
      > <iframe name="iframeNam e" src="table.html "></iframe>
      > that way you can in all browsers script
      > window.frames.i frameName.locat ion.reload();
      > Refreshing an <object> is difficult across browsers, recent Opera and
      > Netscape/Mozilla version allow you to access the contentDocument property
      > of the HTMLObjectEleme nt element object and then you can access the
      > defaultView and from there the location object:
      >
      > <object id="object1"
      > type="text/html"
      > data="test20040 90402.html">
      > width="200" height="200"></object>
      > <input type="button" value="refresh"
      > onclick="var object = document.getEle mentById('objec t1');
      > if (object.content Document &&
      > object.contentD ocument.default View &&
      > object.contentD ocument.default View.location) {
      > object.contentD ocument.default View.location.r eload();
      > }">[/color]

      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... :(

      [color=blue]
      >
      > Martin Honnen
      > http://JavaScript.FAQTs.com/[/color]


      Comment

      • Martin Honnen

        #4
        Re: embedded html page



        Moist wrote:
        [color=blue]
        > "Martin Honnen" <mahotrash@yaho o.de> a écrit dans le message de news:
        > 4139d29e$0$2846 2$9b4e6d93@news read4.arcor-online.net...
        >[color=green]
        >>
        >>Moist wrote:
        >>
        >>
        >>[color=darkred]
        >>>I have an embedded HTML object as follows (ignore the code tag):
        >>>
        >>><code>
        >>> <object id="page" data="table.htm l" type="text/html" .... >
        >>></code>
        >>>[/color][/color][/color]
        [color=blue]
        > But do you know if IE can access
        > embedded objects in a HTML page, or at least reload them.[/color]

        IE can access the object elemens the same way as other elements, e.g.
        var page;
        if (document.getEl ementById) {
        page = document.getEle mentById('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/

        Comment

        • Moist

          #5
          Re: embedded html page

          >>>>I have an embedded HTML object as follows (ignore the code tag):[color=blue][color=green][color=darkred]
          >>>>
          >>>><code>
          >>>> <object id="page" data="table.htm l" type="text/html" .... >
          >>>></code>
          >>>>[/color][/color]
          >[color=green]
          >> But do you know if IE can access embedded objects in a HTML page, or at
          >> least reload them.[/color]
          >
          > IE can access the object elemens the same way as other elements, e.g.
          > var page;
          > if (document.getEl ementById) {
          > page = document.getEle mentById('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.
          >[/color]

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

          object = document.getEle mentById('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
          [color=blue]
          > --
          >
          > Martin Honnen
          > http://JavaScript.FAQTs.com/[/color]


          Comment

          • Moist

            #6
            Re: embedded html page


            "Moist" <a@b.com> a écrit dans le message de news:
            izH_c.445$dd5.1 56359@weber.vid eotron.net...[color=blue][color=green][color=darkred]
            >>>>>I have an embedded HTML object as follows (ignore the code tag):
            >>>>>
            >>>>><code>
            >>>>> <object id="page" data="table.htm l" type="text/html" .... >
            >>>>></code>
            >>>>>[/color]
            >>[color=darkred]
            >>> But do you know if IE can access embedded objects in a HTML page, or at
            >>> least reload them.[/color]
            >>
            >> IE can access the object elemens the same way as other elements, e.g.
            >> var page;
            >> if (document.getEl ementById) {
            >> page = document.getEle mentById('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.
            >>[/color]
            >
            > Using your code and trying 'location.href' instead, it seems to work:
            >
            > object = document.getEle mentById('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[/color]

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

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

            Moist
            [color=blue]
            >[color=green]
            >> --
            >>
            >> Martin Honnen
            >> http://JavaScript.FAQTs.com/[/color]
            >
            >[/color]


            Comment

            • Michael Winter

              #7
              Re: embedded html page

              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.
              [color=blue]
              > I discovered even simpler, just by using the name of the object directly:
              >
              > table.location. href = "c:\\table.html ";[/color]

              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.

              Comment

              Working...