3

I'm trying to optimize my application experience based on the kind of bandwidth the user has. For example, if the user is on a really slow 2G connection, I would render fewer graphics and less content, for high speed connections, I would include video, animations, etc.

Are there JS libraries that allow you to do this? What's the best practice?

antonpug
  • 13,724
  • 28
  • 88
  • 129
  • Your best bet is to write a script that times how long it takes for a user to load an image. Then based off that time compute their average bandwidth. It is not the most accurate of ways, but its an estimate. – cela Feb 07 '18 at 20:39
  • @chrisz that post is from years ago. 2011? That's 7 years. Web is a different place. – antonpug Feb 07 '18 at 20:44
  • And? The top answer was updated within the last year, and the included snippet works. Are you looking for an answer tailored to your question when you provided no attempt? – user3483203 Feb 07 '18 at 20:47

1 Answers1

1

Even if you get the connection type for a user you will not be able to guarantee that is working as expected. I suggest to explore

This blog also have good ideas around that.

LMC
  • 10,453
  • 2
  • 27
  • 52