Requirements Description:
The JS implementation copies the data of an element in the page to the Clipboard.
Requirements Analysis:
to use JS to achieve the biggest problem is the browser compatibility issues. And the biggest problem is the browser for security reasons, such as Chrome,firefox and other browsers are not allowed to access.
Solution:
The Final Solution is also implemented via Flash, which searches the web (keyword: JS access clipboard) A whole bunch of stuff, but it's probably the only solution! I didn't expect Flash to be the ultimate solution. When one day flash completely abandoned by the browser I think this will be a big problem. But this is not the problem I need to worry about whether Flash will be eliminated or a problem.
a lot of wordy. Now let's talk about the concrete implementation.
now a lot of the implementation of JS plug-ins, there is the original JS implementation, there is a way to achieve through jquery do not rub much, but will be used to zeroclipboard.swf.
related plugins by:
1). Zeroclipboard GitHub,Zeroclipboard official website , this is JavaScript implementation, do not need to rely on jquery.
2). Zclip official website, this is a plugin of jquery to rely on jquery.
In fact, it's very simple to look at official documents, but I have some problems when I do it alone (I'm using jquery's Zclip), but when it comes to the project, there's no problem, and I think the problem is that there might be a problem with setting the path, as follows:
$ ("#copy-button"). Zclip ({ path: "js/zeroclipboard.swf", copy:function () { return $ (this). Prev (). Val () ;
Summary:
This article is only to reduce the waste of valuable time for everyone. Spend your time on meaningful things. Keep on fighting, young generation.