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:
- you know size of file
- you can time takes download
- 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
Post a Comment