about measuring bandwidth with javascript -


i trying inject java script snippet webpage. in java script, try measure total amount of data downloaded webpage, data size divided page load time calculate bandwidth.

does know how measure how data downloaded in complete event in java script?

the suggested way measure bandwidth download file purposely measure don't want use.

thanks lot

the suggested way bandwidth (both upload , download) download/upload file of known size, take difference of start time , end time, divide size time took download/upload it.

the suggested way easiest way since:

  1. you know size of file
  2. you can time takes download
  3. and have control of time when starts , finishes

normally can. problem gauging speed using resources loaded on current page need hook every resource, includes (but not limited to):

  • images
  • scripts
  • stylesheets
  • frames
  • xhr (ajax)
  • sockets
  • the page itself
  • and other stuff missed.

pages load resources in combination of sequential , parallel requests start , end @ varying points in time. may delay loading using loader scripts, @ time try check, might not have responded yet.

also, if use script, script must load way before hook on page. problem here not resources have reliable onload event, link element.

i suggest stick easy method.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -