简体   繁体   English

使页面脚本无法访问由扩展内容脚本生成的HTML

[英]make HTML generated by content scripts of extensions inaccessible to page scripts

I would like to show HTML elements generated by extension content scripts over/inside the window area but make them inaccessible for site scripts so the page could not potentially detect/modify them through DOM. 我想在窗口区域的上方/内部显示由扩展内容脚本生成的HTML元素,但使站点脚本无法访问它们,因此该页面可能无法通过DOM检测/修改它们。 Are there any techniques specific for extension development which would allow to do this? 是否有特定于扩展开发的技术可以做到这一点? Like layering or so 像分层一样

There aren't any special Chrome Extension techniques for this. 对此没有任何特殊的Chrome扩展技术。 As you'll read here , JavaScript injected via a content script is automatically sandboxed, or separated from the JavaScript on a web page, but this is not the case for HTML -- the DOM elements are shared between the page scripts and the injected content scripts. 正如您将在此处阅读的那样,通过内容脚本注入的JavaScript会自动沙盒化,或与网页上的JavaScript分离,但HTML并非如此-DOM元素在页面脚本和注入的内容之间共享脚本。

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

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