javascript - How to use userscripts in a site?(How does Greasemonkey work) -


userscripts used add-ons greasemonkey. how can utilize these scripts in site?

for example, found script eliminate ads in videos, , want put script in site, people in site wont't see ads

i've tried save , put in <script> in head, went wrong. (typeerror: document.body null)

i tried put before </body>, no error reported time, still doesn't work.

and i'm wondering how greasemonkey works? insert scripts in webpage? how load scripts pages?

greasemonkey , userscripts.org meant provide kind of lightweight extensions for browser, not webpages. i.e. install them user inside browser.

some of trivial scripts might incorporated webpages, in general, greasemonkey has "superpowers" things ordinary javascript can't due security constraints. instance, issuing (and reading response of) cross-domain xmlhttprequest, interactions between frames different origin etc.

normally greasemonkey scripts executed when domcontentloaded fired browser (this can changed using @run-at directive execute script before loaded).

if script has @grant none in gm meta section, perhaps incorporated site, depends on does.

bear in mind greasemonkey firefox extension (there's equivalent extension chrome , limited native support chrome , opera). many userscripts fail in ie8.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -