Mahendran Sakkarai
Mahendran Sakkarai

Reputation: 8539

Caching uploadify files crashes the chrome

I am using uploadify. when i try to open the page with uploadify script the page is crashed. I using this for a long time. but now only I am getting the error.

Its happening only in chrome. Its working perfectly in firefox, safari, and IE.

I searched through the google and find a solution like disable cache in the browser(working). But its not the best way to do this in the client browser. Is there any way to disable cache for the specific page using htaccess?

I tried the following in the htaccess. but no use.

<Files jquery.uploadify.js>
    ExpiresDefault "access plus 0 seconds"
</Files>

Please suggest me to solve this problem.

Upvotes: 4

Views: 3560

Answers (2)

Mahendran Sakkarai
Mahendran Sakkarai

Reputation: 8539

Finally i solved it by adding an extra parameter(changing the URL or versioning the file) ?ver=<?php echo rand(0,9999);?> to the .js file like below.

<script src="js/jquery.uploadify.min.js?ver=<?php echo rand(0,9999);?>" type="text/javascript"></script>

For more information check this

UPDATE(27-01-2015):

The above solution is not working now. Found another solution. Add timeout around the uploadify function like below will prevent the chrome to crash. Its not the correct solution but it will prevent now. The forum of uploadify also locked. So, I cant able to post a question regard this.

setTimeout(function () {
    $("#uploadify_id").uploadify({})...
},0);

Thanks for everyone.

Upvotes: 23

Ken Le
Ken Le

Reputation: 1805

Put @date("U") after your script src. Like this:

js/jquery.uploadify.min.js?<?=@date("U")?>

It will fix the problem of caching crash.

Upvotes: 2

Related Questions