简体   繁体   English

如何将外部 javascript 文件注入页面?

[英]How to inject external javascript file to the page?

I need to inject some external js widget to the page.我需要向页面注入一些外部 js 小部件。 How to do that with the manifest 3?如何使用清单 3 做到这一点? Seems like chrome.scripting doesn't accept links.好像chrome.scripting不接受链接。 I could've easily done that with manifest v2 but manifest v3 forbids any other approaches other than using chrome.scripting .我可以使用 manifest v2 轻松做到这一点,但 manifest v3 禁止使用chrome.scripting以外的任何其他方法。 I can't move to manifest v2 because it'll get deprecated after the new year.我不能移动到 manifest v2,因为它会在新年后被弃用。

Screw the security: They completely forbade remotely hosted code: https://developer.chrome.com/docs/extensions/mv3/intro/mv3-overview/#remotely-hosted-code搞砸安全性:他们完全禁止远程托管代码: https://developer.chrome.com/docs/extensions/mv3/intro/mv3-overview/#remotely-hosted-code

So that's impossible to inject any code from a link.因此,不可能从链接中注入任何代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM