How does Feed.ly determine iFrame load progress?

两盒软妹~` 提交于 2019-12-06 04:40:58

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/28353988/how-does-feed-ly-determine-iframe-load-progress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!