【发布时间】:2025-12-27 09:20:10
【问题描述】:
问题
我曾经能够(在本地)使用以下两个 Chrome 扩展中的任何一个来轻松地将 jQuery 注入到没有 jQuery 的页面中,并且我没有拥有(客户端)来试验设计更改、开发修改和实时故障排除:
不幸的是,现在由于防止“XSS”(跨站点脚本)的最新热潮,这些插件不再起作用。这些变化背后可能有一个崇高的目的,我只是想了解发生了什么变化。我认为这与“内容安全政策”有关,我最近才听说并且知之甚少。
我在 2011 年第一次了解到 XSS 作为浏览器问题,然而,XSS 预防措施之前从未阻止我进行本地开发。我一直在寻找现代(2017 年末)的解决方案,但无济于事。
我不知道从这里去哪里。
我尝试过但没有奏效的方法
以下是我尝试过的插件(大约在 6 个月前还可以使用),但对我不再有效:
- jQuery in Console (Plugin)
- jQuery Inject (Plugin)
- jQuery Injector (Plugin)
- GitHub - bluerabbit/jquery-inject: jQuery-inject(Chrome extension)
以下是我遇到的许多链接中的一些,它们提供了不再有效的解决方案:
- How to inject script into a page using bookmarklet if the Content Security Policy is enabled on the server?
- Include jQuery in the JavaScript Console
- How to inject jquery to any webpage
- How do I include a JavaScript file in another JavaScript file?
- Google Chrome Extensions: How to include jQuery in programmatically injected content script?
- Inject jQuery Onto Any Site | brandon martinez
- Content Scripts - Google Chrome
最后一个看起来也很有希望,但我还没有尝试过:
我的问题
如何将 jQuery(使用 Chrome 开发者控制台)注入到不使用 jQuery 的网页中?
-
2017 年浏览器/JavaScript/编程世界是否发生了足够大的变化,如果有人知道这种特殊的变化或现象,很容易解释为什么上述插件不再起作用?
李> 为什么上述插件不起作用?今年是否所有浏览器公司都普遍推出了一些重大变化?
【问题讨论】:
-
你能告诉我为什么你需要注入 jquery 吗?我的意思是为了什么目的? #wantToKnow
-
我刚刚测试了您发布的一个插件,它运行良好:chrome.google.com/webstore/detail/jquery-inject/…
-
我可以很好地使用您的参考*.com/questions/7474354/…。我没有尝试其余的,因为这对我有用
-
@plonknimbuzz 我已经在这里解释过了:
(client-side) to experiment with design changes, development modifications, and real-time troubleshooting -
@plonknimbuzz 谢谢。我会研究这些因素。我试图更新我对上述“为什么”的评论,但没有成功,所以这是我的其余回复。:
From time to time I will run across old, basic websites and using jQuery I can quickly mock up what an upgrade might look like for the owner who, as a freelance web developer/designer, I am hoping to make my client.希望对您有所帮助。
标签: javascript jquery dependency-injection google-chrome-devtools