阻止 Safari 扩展中的特定 javascript 文件
免责声明:我以前从未编写过 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个现有的扩展阻止给定网页上的所有 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.