在Mozilla Firefox的每个页面上运行自定义Javascript [英] Running custom Javascript on every page in Mozilla Firefox

查看:169
本文介绍了在Mozilla Firefox的每个页面上运行自定义Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义的Javascript段,我想运行在每个特定域的网页上,或者只是在每一个网页上。

(如果你想知道这不是恶意的,它允许使用MathJax显示公式。)

这可能吗?我试图将其包含在userContent.css中,那当然是行不通的。

我试过的一个简单的Greasemonkey脚本没有插入。是否因为安全预防措施? (这将是非常合乎逻辑的)。

不过,应该有一种方法可以在我物理控制的机器上完成,通过改变Mozilla chrome目录中的内容,不管怎样,我该如何为自己做这件事?

解决方案

欢迎来到stackoverflow!

Greasemonkey应该做你想做的。如果它不工作,或者它没有被应用到正确的域名,或者代码包含某种错误! (我个人使用堆栈溢出的油渍猴子来做一些改变的答案区)。

尝试在您的代码中放置一些警报(),以确保您的油猴脚本正在按预期执行。


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?

解决方案

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.

这篇关于在Mozilla Firefox的每个页面上运行自定义Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆