将内容脚本注入到background.html中的iframe中 [英] Inject content script into iframe inside background.html

查看:106
本文介绍了将内容脚本注入到background.html中的iframe中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能?

我希望这样做,以便在发送XHR时可以 伪造原始/主机标头。 background.html。
我可以让它打开一个新标签页或一个弹出窗口,并将代码注入到该页面中,但这不是我们所希望的。

I want to do this so I can kinda fake the origin/host header, when sending a XHR from background.html. I could make it open a new tab or a popup and inject the code into that, however that is not desirable.

推荐答案

令人遗憾的是,你不能。
executeScript是一个选项卡的方法。您的框架必须在选项卡中才能注入您的内容脚本。

Regretably, you cannot. executeScript is a tab's method. Your frame has to be in a tab in order to inject your content script in it.

这篇关于将内容脚本注入到background.html中的iframe中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆