C# AJAX 进度条显示页面加载的加载进度百分比

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/796792/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 01:32:29  来源:igfitidea点击:

AJAX progress bar dispaying loading progress percentage for page load

c#ajaxasp.net-ajaxprogress-bar

提问by Josh

How do you use a progressbar to show the loading percentage for a page? ...(similar to how they show in flash)

如何使用进度条显示页面的加载百分比?...(类似于它们在 flash 中的显示方式)

Thanks

谢谢

采纳答案by Soul_Master

Impossible(on IE8 & FF3 & Opera without plugin or extension). If you want real loading percentage include HTML + Javascript + Stylesheet + Image. you can only detect how many file loaded to page(only Image & javascript can be detected by this technique).

不可能(在没有插件或扩展的 IE8 & FF3 & Opera 上)。如果你想要真正的加载百分比包括 HTML + Javascript + 样式表 + 图像。您只能检测加载到页面的文件数量(此技术只能检测图像和 javascript)。

回答by Svish

I would say that if you need a progressbar for a page, that page might need some rethinking.

我想说的是,如果您需要一个页面的进度条,那么该页面可能需要重新思考。

Personally I don't like pages that have progress bars (Like the one in the ASUS Download Area). They are just annoying. My browser already have a progressbar. And I would like my bandwidth to be used to download the page and not graphics that would just tell me that I am still waiting for the page.

我个人不喜欢有进度条的页面(比如华硕下载区中的那个)。他们只是烦人。我的浏览器已经有一个进度条。我希望我的带宽用于下载页面,而不是那些只会告诉我我仍在等待页面的图形。

When it comes to AJAX requests ON a page though, I would just use a spinner thing of some sort. To tell the user that something is going on and that the page is not dead. And again, if the background request takes so long that you would need a progressbar, I would again say that the background request should maybe be rethought.

不过,当涉及到页面上的 AJAX 请求时,我只会使用某种微调器。告诉用户某些事情正在发生并且页面没有死。再一次,如果后台请求花费的时间太长以至于您需要一个进度条,我会再次说后台请求可能应该重新考虑。

回答by Svish

oh that so easy, you copy down my code and paste on your website, however is not very cool, but still can use.

哦,这么简单,你把我的代码复制下来粘贴到你的网站上,虽然不是很酷,但仍然可以使用。

CODE : <SCRIPT LANGUAGE='JavaScript' SRC='http://www.seabreezecomputers.com/tips/progress.js' TYPE='text/javascript'> </SCRIPT>

代码 : <SCRIPT LANGUAGE='JavaScript' SRC='http://www.seabreezecomputers.com/tips/progress.js' TYPE='text/javascript'> </SCRIPT>

REMEMBER THIS CODE IS PASTE BETWEEN "/Head" and "BODY"

  [1]: http://dw6-vista-tdx.blogspot.com

请记住此代码粘贴在“/Head”和“BODY”之间

  [1]: http://dw6-vista-tdx.blogspot.com

回答by Svish

Hey, check out the upload progress dialog at s3fm, a free online Amazon s3 file manager.

嘿,查看s3fm上的上传进度对话框,是一个免费的在线 Amazon s3 文件管理器。