Feed.ly如何确定iFrame加载进度? [英] How does Feed.ly determine iFrame load progress?

查看:172
本文介绍了Feed.ly如何确定iFrame加载进度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您阅读Feed.ly上的RSS项目,则可以选择预览该项目,从而在iFrame中打开相应的URL。他们不知何故在框架上获得了一个加载栏,但无法弄清楚他们如何获得加载百分比。





如果他们伪造它们,他们的工作非常出色。任何人都有任何想法如何从iframe获取加载进度?如果你不能得到一个实际的bytesLoaded和bytesTotal,您可以追踪所有用户加载该iframe所需的时间,然后获得平均加载速度,然后用它来管理进度栏。如果您希望它更加准确,那么您可以跟踪当前用户的加载速度与他们预览的每个项目(或可能是每个Feed)的平均加载速度相匹配,并基于该用户的相对时间开发更好的近似值。

前几个人只是猜测,但在此之后,你可能会变得相对接近。当然,如果你有大量的用户,这种方法会更好地工作,就像feedly一样。对于一个小型网站或更多的小众RSS源,它将不太有用。



编辑:我认为他们实际上并没有这样做。至少,我没有看到他们提出任何追踪请求。我认为他们可能只是伪装而已。在预览了很多项目之后,有时候它会在消失时半满,有时甚至会在您看到白屏之前完全填满。我认为这是一种安慰剂。


If you read RSS items on Feed.ly, you have an option to "preview" the item, which opens up the corresponding URL in an iFrame. They have somehow gotten a load bar on top of the frame though, can't figure out how they got access to the load percentage.

If they're faking it, they're doing a fantastic job. Anyone have any idea how to get load progress from an iframe?

解决方案

If you couldn't get an actual bytesLoaded and bytesTotal, you could track how long it takes all users to load that iframe and come up with an average loading speed that you then use to govern the progress bar. If you wanted it to be even more accurate, you could track how the current user's loading speeds match up to the average loading speeds on every item they preview (or maybe per feed) and develop an even better approximation based on that user's relative times.

The first few people would just be guesswork but after that, you might be able to get relatively close. Naturally, that approach is going to work better when you have a large number of users, like feedly does. For a smaller site or more niche RSS feeds, it would be less useful.

Edit: I don't think they're actually doing that though. At least, I don't see them making any tracking requests. I think they're probably just faking it. After previewing a lot of items, sometimes the bar is only half way full when it disappears and sometimes it fills in completely before you see more than a white screen. I think it's a placebo.

这篇关于Feed.ly如何确定iFrame加载进度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆