"JS" JS access to the Clipboard (compatible with major browsers) the only solution zeroclipboard.swf

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.