How to use user script (custom script) Chrome

Source: Internet
Author: User

Many of you are already using Greasemonkey, for example, in FF. However, it is not convenient to write your own scripts, so we will not write FF here.

After a certain version of CH, it does not support online installation of. user. js scripts. For the sake of security, you must drag the prepared scripts to the chrome: // chrome/extensions/page for installation.

When writing a script for the first time, you need to solve the following problems:

  1. Take effect on some sites: Add a header such as: // @ include http://www.cnblogs.com /*
  2. How to Use jquery and other scripts: require can be used in the past. Now ch does not support it. For security reasons, you can also use the hack method to operate on the dom. It's very easy to say nothing, no, just paste jquery into it;
  3. How to call the function on the current page is not allowed by default. As mentioned above, it is possible to operate the dom. Write your script as follows:
Var script = document. createElement ('script'); script. appendChild (document. createTextNode ('+ main +') (); '); (document. head ). appendChild (script );

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.