在 Mozilla Firefox 的每个页面上运行自定义 Javascript
我有一段自定义的 Javascript,我想在特定域的每个网页上运行它,或者只是在每个网页上运行。
(如果您想知道:它不是恶意的。它允许使用 MathJax 显示公式。)
这可能吗?我尝试将其包含在 userContent.css 中,但这当然不起作用。
我尝试过的一个简单的 Greasemonkey 脚本没有插入它。是因为安全措施的原因吗? (这是非常合乎逻辑的)。
不过,应该有一种方法可以在我物理控制的机器上完成此操作,通过更改 Mozilla chrome 目录中的某些内容,不是吗?
无论如何,我怎样才能为自己做到这一点呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
油猴应该做你想做的事。如果它不起作用,要么它没有被应用到正确的域,要么代码包含某种错误! (我个人在堆栈溢出时使用油脂猴对答案区域进行一些更改)。
尝试在代码中放置一些alerts(),以确保油脂猴脚本按预期执行。
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.