Closed foobear closed 8 years ago
Thanks for your PR. Looks good to me.
I'm OK with the changes but I'm going to forewarn you, @foobear, that you may run into issues in certain usage situations because browsers still don't really understand Flash very well....
e.g. https://github.com/zeroclipboard/zeroclipboard/issues/357
@JamesMGreene - Not sure I fully understand the problem. The change should not affect flash vars, but only omit the noCache
URL param that would force the browser to reload the .swf
file.
When compiling assets, Rails creates specific filenames based on each file's checksum. For version 1.0 of ZeroClipboard.swf
that would be something like ZeroClipboard-abc123.swf
, while version 1.1 results in ZeroClipboard-def456.swf
.
So a changed .swf
file would already force cache busting due to its new (generated) filename, and the cacheBust
option / noCache
param is not necessary and would even force a reload when we know the .swf
is the same.
When using Rails asset digests,
ZeroClipboard.swf
becomes something likeZeroClipboard-abcd1234ef.swf
and is referenced as such through theswfPath
config option, set by zeroclipboard-rails.However, ZeroClipboard also includes its own cache busting mechanism: adding a
noCache
query param that sends the current timestamp. This is not necessary when using Rails asset digests.ZeroClipboard offers a config option to disable
noCache
that we should set tofalse
when using asset digests. Here is a PR for that. :)If you're uncomfortable with my changes using
to_json
, this is maybe less invasive: