加载GIF图像不显示在IE和Chrome [英] Loading gif image is not showing in IE and chrome

查看:136
本文介绍了加载GIF图像不显示在IE和Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用JQuery Ajax调用发送同步调用服务器,并希望以显示该时间加载图像。

I am using JQuery ajax call for sending synchronized call to server and want to display a loading image for that time.

但加载图像是在Firefox,但不可见的IE浏览器和Chrome。当我调试,我发现,在IE浏览器,当我们调用Java脚本,它停止显示变化的浏览器,因为它暂停DOM当通话结束时,则显示了所有的更改。由于我显示了AJAX调用加载图像,并在完成通话后删除,IE的母鹿不显示任何图像。

But loading image is visible in Firefox but not in IE and chrome. When i debug, i found that in IE, when we call java script, it stop showing changes in browser as it halts DOM and when the call is completed, it then shows all the changes. Since i shows the loading image on ajax call and remove it after completing the call, the IE doe not display any image.

但是当我使用警告框,它显示在IE浏览器加载图像,因为它停止线程,直到我们应对之道。

But when i use alert box,it shows the loading image in IE as it stop the thread until we response to it.

有没有什么方法来阻止Java脚本执行了一毫秒,使得IE浏览器执行的暂停和加载图像显示。

Is there any method to stop java script execution for a millisecond such that IE execution halts and loading image is shown.

我已经尝试过ajaxSend,ajaxComplete,ajaxStart,JQuery的的ajaxStop和Java Script的计时器事件,但没有得到任何解决方案。

I already tried ajaxSend, ajaxComplete, ajaxStart, ajaxStop of JQuery and timer event of java script, but does not get any solution.

任何帮助是precious,在此先感谢。

Any help is precious, thanks in advance.

推荐答案

在XHR的背景下,的同步的意思只是说,浏览器冻结,直到该请求完成。如果你想要的是确保只有一个请求是在给定时间运行的,然后使用自己的标志,表示请求正在进行中。

In the context of XHR, synchronously means just that the browser freezes until the request is complete. If what you want is to make sure only one request is running at a given time, then use your own flag to indicate that a request is in progress.

根据定义,一个请求的同步标志意味着其他任何活动都必须停止。我很惊讶,它甚至可以在Firefox中,我最后一次尝试,它没有工作,但那是很久以前的事。所以,忘掉它,有没有办法让它在所有的浏览器。即使你耽误使用的setTimeout ,在最好的,你会得到一个冰冻的浏览器与非gif动画的要求。而且用户不必当你冻结他们的浏览器,特别是如果该请求可能会比第二次的一小部分采取更不喜欢。

By definition, the synchronous flag of a request means that any other activity must stop. I'm surprised that it even works in Firefox, last time I tried that it didn't work, but that was a long time ago. So forget about it, there's no way to make it work in all browsers. Even if you delay the request using a setTimeout, at best you'll get a frozen browser with a non-animated gif. And users don't like when you freeze their browser, especially if the request might take more than a fraction of a second.

永远不要依赖于浏览器的安全性或正确的功能相关的功能。如果您的应用程序可能会被打破,如果客户端执行两个平行的请求,那么你必须在服务器端错误。没有什么是prevents恶意用户拨打使用其他工具比正常的UI并行请求。

Don't ever depend on the browser for security or correct functionality related features. If your application might get broken if a client does two requests in parallel, then you have a bug on the server side. There's nothing that prevents a malicious user from making parallel requests using other tools than the normal UI.

这篇关于加载GIF图像不显示在IE和Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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