Home >Web Front-end >JS Tutorial >jquery.uploadify plug-in frequently crashes in chrome browser solution_jquery

jquery.uploadify plug-in frequently crashes in chrome browser solution_jquery

WBOY
WBOYOriginal
2016-05-16 16:12:051502browse

The jquery.uploadify plug-in frequently crashes in the chrome browser, which has been troubled for a long time. Many people on the Internet say that it is due to the chrome cache. When the plug-in is initialized, js needs to be quoted, and chrome’s cache causes no request to jquery. uploadify-3.1_min.js, so it causes a crash. You can add random numbers when referencing js:

I tried this method and found that this method cannot completely solve the crash problem. For example, after the uploadify page enters other pages, and then clicks back to return to the uploadify page, the crash problem will also occur.

A complete solution: setTimeout, so that the initialization of uplodify and the function of the browser cache module do not occur at the same time

Copy code The code is as follows:

$(function(){
setTimeout(function(){
          $('#file_upload').uploadify({
'SWF': Tools/Uploadify/Uploadify.swf ',
            'uploader' : 'upload.php',
             'onUploadSuccess' : function(file, data, response) {
                                                                                        }
        });
},10);
});

Thanks to netizen hoverlees for sharing this solution. I will record it here and share it with everyone.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn