阻止 Safari 扩展中的特定 javascript 文件

发布于 2024-10-06 10:24:06 字数 390 浏览 0 评论 0原文

免责声明:我以前从未编写过 Safari 扩展,而且我在 Javascript 方面完全是新手,尽管我在其他语言方面确实有丰富的经验。

这是我的问题:我正在编写一个 Safari 扩展来改进我经常访问的某个网站。我想做的改进之一是阻止 ckeditor.js 的加载,

<script type="text/javascript" language="javascript" src="ckeditor/ckeditor.js"></script>

该脚本加载速度慢,运行速度慢,而且我无论如何也无法忍受图形 HTML 编辑器。

是否可以创建一个在下载之前删除 ckeditor.js 的脚本?如果没有,我可以写一些东西在运行之前将其删除吗?

Disclaimer: I've never written a Safari Extension before and I'm an utter newb at Javascript, though I do have plenty of experience in other languages.

Here's my question: I'm writing a Safari Extension to improve a certain site I visit frequently. One of the improvements I'd like to make is to block the loading of ckeditor.js

<script type="text/javascript" language="javascript" src="ckeditor/ckeditor.js"></script>

The script is slow to load, slow to run, and I can't stand graphical HTML editors anyway.

Is it possible to create a script that will remove ckeditor.js before it downloads? If not, can I write something that will remove it before it runs?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2024-10-13 10:24:06

有一个现有的扩展阻止给定网页上的所有 JavaScript。该站点指向两个文件“global.html”和“injected.js”,它们控制是否基于每个元素加载脚本。所以看起来可以修改它以将特定脚本列入黑名单。不过,从“beforeload”事件中找出正确的咒语可能需要一些工作。

There is an existing extension blocking all JavaScripts on a given web page. This site points to two files "global.html" and "injected.js", that control whether to load the script on a per element basis. So it looks like it is possible to modify this to blacklist specific scripts. It might take some work to figure out the right incantation from the "beforeload" event though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文