访问网站时运行自定义Java脚本 [英] Running your custom java script when visiting a website

查看:102
本文介绍了访问网站时运行自定义Java脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我弄乱了inspect元素,并发现每次刷新页面时都会重置Web元素.我开始研究如何控制台片段以及保留日志的内容,但是没有成功,我找不到我想要的东西.我尝试做的是使用以下代码将stackoverflow网站上的"Jobs"更改为"Hello":

I messing around with inspect element and discovered every time you refreshed the page, the web elements would reset. I started researching how to you console snippets and what preserve logs however with no success I could not find what I was looking for. What I tried doing is change "Jobs" on the stackoverflow website to "Hello" using the following code :

document.getElementById('nav-jobs').innerHTML = 'Hello' 

我将其保存为代码段,但是每次访问该页面时都必须手动运行此代码段.可以自动完成吗?

I saved this as a snippet however I have to manually run this snippet every time I visit the page. Can this be done automatically?

我确实知道有一些扩展程序(例如篡改猴子)可以让您执行此操作,但是我想运行自己的Java脚本.有人可以提供指导吗?

I do know there are extensions such as tamper monkey that let you do this however I want to run my own java scripts. Can someone offer their guidance.

谢谢

推荐答案

您必须在TamperMonkey(或Firefox的GreaseMonkey)中运行自己的JavaScript,这是扩展的全部内容,可让您为页面运行自己的脚本,以更改行为或更改内容和功能.我看不到以任何方式,形状或形式运行自己运行",而不是仅仅使用现有功能?

You DO run your own javascripts in TamperMonkey (or GreaseMonkey for Firefox) - that's the whole point of the extensions, letting you run your own scripts for pages, to change behavior or alter content and functionality. I fail to see how "running your own" is in any way, shape or form, better than just using what is already available?

所以答案基本上是:使用TamperMonkey.而且,如果您还想更改CSS,请运行时尚".

So the answer is basically: use TamperMonkey. And if you wanna change CSS as well, run Stylish.

这篇关于访问网站时运行自定义Java脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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