JS Copy Web content and compatible with the main browser code

Source: Internet
Author: User

 js copy of Web page content method code has a lot but to be compatible with the browser is not much, the following has a good way, you can try to operate under

Because need to do a JS click, copy the function of the current Web page URL. The following methods are used, but they can only be used normally in IE browser. The     method follows:  code as follows: Function Copyurl () {  var clipboardcontent= "";  clipboardcontent+= document.title;  clipboardcontent+= "";  clipboardcontent+=this.location.href;  Window.clipboardData.setData ("Text", clipboardcontent);  alert ("Copy succeeded, paste it on your qq/msn and recommend it to your buddy"); }   -------------------------Divider---------------------------    Find a flash  zclip    on the internet zclip  Zclip Plug-ins can be compatible with a variety of browsers.     Using the method is very simple, only need to import a JS file and a SWF file.     Use of the following     need to import the required files:  code as follows: <script type= "Text/javascript" src= "Js/jquery.js" ></ script>  <script type= "Text/javascript" src= "Js/jquery.zclip.js" ></script>    $ ( Document). Ready (function () {  $ (' a#copy-description '). Zclip ({  path: ' js/zeroclipboard.swf ',  copy:$ (' P#description '). Text ()  });   //The link with ID "copy-description" would copy //the Text of the paragraph with ID "description"     $ (' a#copy-dynamic '). Zclip ({  path: ' js/zeroclipboard.swf ',   Copy:function () {return $ (' Input#dynamic '). Val ();  });   //The link with ID "copy-dynamic" would copy the current value /of a dynamically changing Input with the ID "dynamic"    });   
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.