Timing Events

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

    #1

    Timing Events

    I would like to time the loading of a window.

    The following seems only to indicate the time to launch the new window
    not the time to actually download the page for the window. In one case,
    326 milliseconds is reported whereas the page in the window requires
    1535 milliseconds to complete the download - timed by ethereal.

    The purpose of this fuction was meant to be to measure the performance
    of the overall system in serving html pages without having to resort to
    special software on client computers.

    function open_win() {
    var start = new Date()
    window.open("ht tp://www.xyz.com/pdq.html")
    var end = new Date()
    document.write( "<br>" + (end - start) + " milliseconds")
    self.focus()
    }

  • Martin Honnen

    #2
    Re: Timing Events



    Charlie Root wrote:
    [color=blue]
    > I would like to time the loading of a window.
    >
    > The following seems only to indicate the time to launch the new window
    > not the time to actually download the page for the window. In one case,
    > 326 milliseconds is reported whereas the page in the window requires
    > 1535 milliseconds to complete the download - timed by ethereal.[/color]
    [color=blue]
    > function open_win() {
    > var start = new Date()
    > window.open("ht tp://www.xyz.com/pdq.html")[/color]

    That call window.open just opens a new window and starts loading the
    URL, then it returns and subsequently the next statement is executed.
    If you want to check the time a page needs to load you have to use
    var start = new Date();
    var end;
    <body onload="end = new Date();">
    inside of the page to load (e.g. pdq.html)


    --

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

    Comment

    • RobB

      #3
      Re: Timing Events

      Martin Honnen <mahotrash@yaho o.de> wrote in message news:<419b5e6a$ 0$25331$9b4e6d9 3@newsread2.arc or-online.net>...[color=blue]
      > Charlie Root wrote:
      >[color=green]
      > > I would like to time the loading of a window.
      > >
      > > The following seems only to indicate the time to launch the new window
      > > not the time to actually download the page for the window. In one case,
      > > 326 milliseconds is reported whereas the page in the window requires
      > > 1535 milliseconds to complete the download - timed by ethereal.[/color]
      >[color=green]
      > > function open_win() {
      > > var start = new Date()
      > > window.open("ht tp://www.xyz.com/pdq.html")[/color]
      >
      > That call window.open just opens a new window and starts loading the
      > URL, then it returns and subsequently the next statement is executed.
      > If you want to check the time a page needs to load you have to use
      > var start = new Date();
      > var end;
      > <body onload="end = new Date();">
      > inside of the page to load (e.g. pdq.html)[/color]

      And: don't use document.write for output to a loaded document. Print
      to a textfield, or other element.

      Comment

      Working...