This article mainly introduces the implementation method and example of copying content from JavaScript to clipboard compatible with mainstream browsers. It is very practical. If you need more and more browsers, such as IE, Firefox, Chrome, Safari, and so on. Therefore, it is not so easy to implement a small function of copying content from js to the clipboard.
In the FLASH 9 era, there was a scheme to copy content to the clipboard by killing all browsers.:
This solution is one of the most popular methods: the famous Clipboard Copy solution uses a clipboard.swf as a bridge to Copy content to the Clipboard.
The principle is: Create a hidden flash file and assign "clipboard = .." to the flash variable FlashVars. With this assignment, flash will place the copied content to the clipboard. This method is compatible with IE, Firefox, Opera, chrome, and Safari. It is a "omnipotent" solution. The installation rate of browser Flash is very high, which is almost a perfect solution.
The Code is as follows:
Web Developer-www.admindomain.com