Running custom Javascript on every page in Mozilla Firefox

空扰寡人 提交于 2019-12-01 00:10:59

问题


I have a custom piece of Javascript which I would like to run on every web page from specific domains, or perhaps simply on every web page.

(If you are wondering: it is not malicious. It allows to display formulas by using MathJax.)

Is that possible? I tried including it in userContent.css, that of course did not work.

A simple Greasemonkey script I tried did not insert it. Is it because of the security precautions? (Which would be very logical).

Still, there should be a way to do it on the machine I physically control, by changing something in Mozilla chrome directory, shouldn't it?

Anyway, how can I do this for myself?


回答1:


Welcome to stackoverflow!

Greasemonkey should do what you want. If it's not working either it's not being applied to the correct domains, or the code contains some sort of bug! (I personally use grease monkey on stack overflow to make some changes to the answer area).

Try placing some alerts() within your code to ensure that your grease monkey script is executing as intended.




回答2:


If this is your first GreaseMonkey script, I suggest running through the links "For Script Authors" on The GreaseMonkey Wiki.



来源:https://stackoverflow.com/questions/2778564/running-custom-javascript-on-every-page-in-mozilla-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!